Uh oh!
There was an error while loading. Please reload this page.
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
welshm
commented
Jun 15, 2021
| if (!this.apiFirst && !this.reactive) { | ||
| additionalProperties.put("useSpringfox", true); | ||
| if (this.useSpringfox) { | ||
| if (!this.apiFirst && !this.reactive) { |
There was a problem hiding this comment.
minor, can simplify to: this.useSpringFox && !this.apiFirst && !this.reactive
There was a problem hiding this comment.
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
welshm
commented
Jun 21, 2021
@daonomic or @lwlee2608 Would you be an appropriate reviewer for this? |
welshm
commented
Jun 29, 2021
@wing328 - wondering if you can help me find an appropriate reviewer or how I might go about getting this added? |
welshm
commented
Jul 12, 2021
@4brunu Would you be able to help me get a review started on this? I have not had responses from anyone else so far |
4brunu
commented
Jul 12, 2021
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) |
welshm
commented
Jul 15, 2021
I'm happy to join or participate in a technical committee if that might help... |
welshm
commented
Jul 26, 2021
@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... |
wing328
commented
Jul 26, 2021
Let me try to take a look tomorrow or later this week. |
welshm
commented
Jul 30, 2021
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
welshm
commented
Aug 6, 2021
@wing328 any chance to get this reviewed? |
welshm
commented
Aug 23, 2021
@wing328 Updated with latest master and regenerated tests/samples |
MichaelKunze
commented
Aug 25, 2021
Would be cool if this PR gets considered! Need this too. |
welshm
commented
Sep 1, 2021
@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. |
InfoSec812
commented
Oct 26, 2021
@welshmHERE is an example where the |
welshm
commented
Oct 29, 2021
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 |
wing328
commented
Nov 2, 2021
Did a few more tests and the results are good so let's merge this one and file separate PRs for enhancements if needed. |
atkawa7
commented
Nov 2, 2021
@wing328 would you be able to do a minor release to test this out |
wing328
commented
Nov 3, 2021
@atkawa7 can you please use the SNAPSHOT version (links in the readme) before v5.3.1 release (which is scheduled a month later)? |
atkawa7
commented
Nov 3, 2021
Thanks @wing328 |
mhinders
commented
Dec 17, 2021
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? |
welshm
commented
Dec 17, 2021
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 ( |
BlackSunshine-manage
commented
Dec 22, 2021
Hello! how i can use this plugin?? this is a big work and i waited to long time this. You're really cool! |
Jey2k
commented
Dec 23, 2021
Hi, I suppose it should be included into @Schema, isn't it ? |
marinus-suniram
commented
Dec 29, 2021
I have the same problem with the default value |
welshm
commented
Dec 29, 2021
Please see this change #11181 from @cachescrubber which is addressing the issues of default params and Schema (along with other issues) |
kdebski85
commented
Dec 30, 2021
I also have the issue with defaultValue for Parameter. I created #11203 |
mhinders
commented
Jan 3, 2022
I missed that the annotation is present on the interface. That is sufficient for me. |
shivaprasadgurram
commented
Jul 15, 2022
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. |
Moonergfp
commented
Jun 12, 2023
what would be shown when you open swagger-ui page? |
Add in
oas3option for Spring codegen to use newer annotationsAdd
useSpringControlleroption for Spring codegenUse
useSpringfoxto fix some unwanted imports for Spring codegenUse
jdk8to add OffsetDateTime import for models in Spring codegenAdd
JsonValuetoenumOuterClass.mustacheto allow enums to begenerated properly
To test, use
oas3: trueuseSpringController: trueanduseSpringfox: falsein a config file to generate a Spring target.To close#9774
PR checklist
master,5.1.x,6.0.x