Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fixed a bug that duplicate field were get for record classes #1855

Merged
merged 1 commit into from
Sep 28, 2022

Conversation

uc4w6c
Copy link
Collaborator

@uc4w6c uc4w6c commented Sep 22, 2022

Describe the bug

When the argument of the MethodParameterPojoExtractor.extractFrom method is a record class, duplicate fields gets.

  1. when the argument is a class (expected)
// The ClassObject class has email, firstName, lastName fields and getters 
Stream<MethodParameter> actual = MethodParameterPojoExtractor.extractFrom(ClassObject.class);
actual.forEach(method -> System.out.println(method.getMethod().getName()));

// Below is the output result.
// getEmail
// getFirstName
// getLastName
  1. when the argument is a record (unexpected)
record RecordObject(String email, String firstName, String lastName) {}
Stream<MethodParameter> actual = MethodParameterPojoExtractor.extractFrom(RecordObject.class);
actual.forEach(method -> System.out.println(method.getMethod().getName()));

// Below is the output result.
// email
// firstName
// lastName
// email
// firstName
// lastName
// email
// firstName
// lastName

Fixes

Added filter as well as Class.

@bnasslahsen bnasslahsen merged commit ddf6738 into springdoc:2.x Sep 28, 2022
@bnasslahsen
Copy link
Collaborator

Thank you @uc4w6c for your contribution to the project.

@uc4w6c uc4w6c deleted the fix_record_field_get branch October 14, 2022 15:09
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants