Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

refactor: Delete isFinal , isStatic to support recored #120

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

thdwoqor
Copy link

@thdwoqor thdwoqor commented Sep 9, 2023

#105

val modifiers = field.getModifiers();
      if (isFinal(modifiers) || isStatic(modifiers)) {
        continue;
      }

This code causes the recorded dto to not work correctly
More precisely, the @FormProperty annotation does not work.

"Pojo" does not Limit field.
You also don't need to Limit the field of 'DTO'


Example

@FeignClient(url="https://oauth2.googleapis.com", value = "GoogleAuthApi")
public interface GoogleAccessTokenClient {

    @PostMapping(
            value = "/token",
            consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE,
            produces = MediaType.APPLICATION_JSON_VALUE
    )
    GoogleAccessTokenResponse getGoogleToken(
            GoogleAccessTokenRequest request
    );
}

@Data
public class GoogleAccessTokenRequest {

    @FormProperty("client_id")
    private String clientId;
    @FormProperty("client_secret")
    private String clientSecret;
    private String code;
    @FormProperty("redirect_uri")
    private String redirectUri;
    @FormProperty("grant_type")
    private String grantType;
}

Code where the @FormProperty annotation works correctly

public record GoogleAccessTokenRequest(

        @FormProperty("client_id")
        String clientId,
        @FormProperty("client_secret")
        String clientSecret,
        String code,
        @FormProperty("redirect_uri")
        String redirectUri,
        @FormProperty("grant_type")
        String grantType
) {
}

Code where @FormProperty annotations don't work correctly

@OlgaMaciaszek
Copy link

Thanks, I'm not a maintainer in the OpenFeign org, only in Spring Cloud OpenFeign. CC @velo .

@debcode-me
Copy link

Just out of curiosity, do we need to update the test cases?
And can someone also shed some light of the use cases for which these isStatic & isFinal filters were added.

@robinmayerhofer
Copy link

These isStatic and isFinal filters also affect data classes with vals in Kotlin - they simply won't be serialized.

@alexandrklimov
Copy link

Does anybody know, there is any plans to merge this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants