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

Fix generating default values #1688

Merged

Conversation

altro3
Copy link
Collaborator

@altro3 altro3 commented Aug 9, 2024

Fixed #1686

@altro3 altro3 force-pushed the fix-generator-for-default-values branch from 83f9b31 to 47c0a90 Compare August 9, 2024 13:03
@altro3 altro3 requested a review from graemerocher August 9, 2024 13:04
@altro3 altro3 force-pushed the fix-generator-for-default-values branch 2 times, most recently from e0179ae to 94584b9 Compare August 9, 2024 13:27
assertFileContains(path + "api/DefaultApi.kt",
"@PathVariable(name = \"apiVersion\", defaultValue = \"v5\") @Nullable apiVersion: BrowseSearchOrdersApiVersionParameter? = BrowseSearchOrdersApiVersionParameter.V5,",
"@Header(name = \"Content-Type\", defaultValue = \"application/json\") @Nullable contentType: String? = \"application/json\""
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The last case I was hoping for is XFavorToken default null to work. Is that easy to add?

@Header("X-Favor-Token") @Nullable xFavorToken: String? = null

Not sure you'd even have a defaultValue in the annotation for null since it has to be a string

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@scprek
Copy link
Contributor

scprek commented Aug 9, 2024

Looking good, I got the same! Question about the default: null ones tho.

        @PathVariable(name = "apiVersion", defaultValue = "v5") @NotNull apiVersion: ApiVersion = ApiVersion.V5,
        @Header("X-Favor-Token") @Nullable xFavorToken: String?,
        @Header(name = "Content-Type", defaultValue = "application/json") @Nullable contentType: String? = "application/json"

@altro3 altro3 force-pushed the fix-generator-for-default-values branch from 94584b9 to c34358a Compare August 10, 2024 06:03
Copy link
Contributor

@scprek scprek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing Thanks! Default null worked in my test.

@altro3 altro3 force-pushed the fix-generator-for-default-values branch from c34358a to 872a460 Compare August 19, 2024 07:30
@scprek
Copy link
Contributor

scprek commented Aug 21, 2024

Will this get into 6.12 snapshot soon?

@sdelamo
Copy link
Contributor

sdelamo commented Aug 21, 2024

@altro3 can you merge 6.12.x into this branch?

@altro3 altro3 force-pushed the fix-generator-for-default-values branch from 872a460 to a801897 Compare August 21, 2024 11:53
@altro3
Copy link
Collaborator Author

altro3 commented Aug 21, 2024

@sdelamo done

@sdelamo
Copy link
Contributor

sdelamo commented Aug 21, 2024

@altro3 can you merge 6.12.x into this branch?

@altro3 altro3 force-pushed the fix-generator-for-default-values branch from a801897 to 1634754 Compare August 21, 2024 16:36
@scprek
Copy link
Contributor

scprek commented Aug 22, 2024

Noticed 1 possible issue, but can open a new ticket #1686 (comment)

@sdelamo sdelamo merged commit 5ec7a4e into micronaut-projects:6.12.x Aug 22, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Default Values not working unless type is a String with enum values
3 participants