-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
Allow Spring generated code to use new OAS 3 annotations #9775
Conversation
- Add in `oas3` option for Spring codegen to use newer annotations - Add `useSpringController` option for Spring codegen - Use `useSpringfox` to fix some unwanted imports for Spring codegen - Use `jdk8` to add OffsetDateTime import for models in Spring codegen - Add `JsonValue` to `enumOuterClass.mustache` to allow enums to be generated properly
Bring `welshm` fork up to master
if (!this.apiFirst && !this.reactive) { | ||
additionalProperties.put("useSpringfox", true); | ||
if (this.useSpringfox) { | ||
if (!this.apiFirst && !this.reactive) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor, can simplify to: this.useSpringFox && !this.apiFirst && !this.reactive
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add comments - I assume that springFox cannot be used when apiFirst and reactive is enabled but we don't use those options so I wanted it to be clear that this check is separate from the useSpringFox
option check
@daonomic or @lwlee2608 Would you be an appropriate reviewer for this? |
@wing328 - wondering if you can help me find an appropriate reviewer or how I might go about getting this added? |
@4brunu Would you be able to help me get a review started on this? I have not had responses from anyone else so far |
You need to copy the java technical committee members for review. @bbdouglas (2017/07) @sreeshas (2017/08) @jfiala (2017/08) @lukoyanov (2017/09) @cbornet (2017/09) @jeff9finger (2018/01) @karismann (2019/03) @Zomzog (2019/04) @lwlee2608 (2019/10) @nmuesch (2021/01) |
I'm happy to join or participate in a technical committee if that might help... |
@4brunu do you happen to know what the expected response time is for opening a PR and receiving a review or for applying for the technical commmittee? Part of wanting to contribute back is so that my organization doesn't diverge too much from the project here, but it's now been over a month with no response to opening the PR other than from yourself... |
Let me try to take a look tomorrow or later this week. |
Just following up here - I will be unavailalbe Aug 3 - 6 if there is feedback on this PR. I am very much interested in joining the technical committee for Spring and Java if you're taking applicants (I did send an email) in order to help keep the generator supported for those languages. |
Bring `welshm` fork up to `OpenAPITools` master
@wing328 any chance to get this reviewed? |
@wing328 Updated with latest master and regenerated tests/samples |
Would be cool if this PR gets considered! Need this too. |
@wing328 @4brunu is there anything more I can do to get this reviewed or looked at by someone on the team that can approve this? This PR has been open for 2+ months, and I've kept it current with the main branch several times, but if no one will review it then there is no value in me maintaining this branch/PR. I am more than happy to get more involved in the project, but my emails asking to join the team have also gone unanswered. |
@welshm HERE is an example where the |
I'd love to keep making improvements for Spring support (Java and eventually Kotlin) so I'll look to make some of those changes in a future PR |
Did a few more tests and the results are good so let's merge this one and file separate PRs for enhancements if needed. |
@wing328 would you be able to do a minor release to test this out |
@atkawa7 can you please use the SNAPSHOT version (links in the readme) before v5.3.1 release (which is scheduled a month later)? |
Thanks @wing328 |
Really happy about this change. I would however be inclined to use springdocs for viewing the API definition. As it is currently the Spring controllers are generated with @org.springframework.stereotype.Controller and not @org.springframework.web.bind.annotation.RestController which means that manual configuration is required as explained here https://springdoc.org/#my-rest-controller-using-controller-annotation-is-ignored. Could the templates be changed to use RestController? |
It can be updated to do that - just for clarity though, I had added this as an option for the interfaces but had left the generated API controller implementations ( |
Hello! how i can use this plugin?? this is a big work and i waited to long time this. You're really cool! |
Hi, I suppose it should be included into @Schema, isn't it ? |
I have the same problem with the default value |
Please see this change #11181 from @cachescrubber which is addressing the issues of default params and Schema (along with other issues) |
I also have the issue with defaultValue for Parameter. I created #11203 |
I missed that the annotation is present on the interface. That is sufficient for me. |
springdoc-openapi-ui not compatible with openapi-generator-maven-plugin. I have a dependency of spring-openapi-ui with version 1.6.9. I can see generated classes are using V3 annotations but when I try to load swagger-ui.html it is not working. Not sure what is going wrong. Can any one help me? Need: I should be able to open swagger-ui page from browser. |
what would be shown when you open swagger-ui page? |
Add in
oas3
option for Spring codegen to use newer annotationsAdd
useSpringController
option for Spring codegenUse
useSpringfox
to fix some unwanted imports for Spring codegenUse
jdk8
to add OffsetDateTime import for models in Spring codegenAdd
JsonValue
toenumOuterClass.mustache
to allow enums to begenerated properly
To test, use
oas3: true
useSpringController: true
anduseSpringfox: false
in a config file to generate a Spring target.To close #9774
PR checklist
master
,5.1.x
,6.0.x