-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
Add externalDocs to @Operation to the JavaSpring generator #14177
Add externalDocs to @Operation to the JavaSpring generator #14177
Conversation
The
|
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.
Can you also regenerate the samples? Or do none of the samples have exeternal docs? If not, perhaps we should add one?
@@ -4478,6 +4478,7 @@ else if (one.required) | |||
op.requiredParams = requiredParams; | |||
op.optionalParams = optionalParams; | |||
op.externalDocs = operation.getExternalDocs(); | |||
op.hasExternalDocs = op.externalDocs != null; |
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.
You're making changes to DefaultCodegen
and CodegenOperation
so you'll also likely need a review from the core team as well (even though this is minor)
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.
We could maybe initiate the hasExternalDocs
attribute at other places. Thus yes the Core Team is welcome :)
@wing328
@jimschubert
@cbornet
@jmini
@etherealjoy
@spacether
@@ -16,6 +16,9 @@ import io.swagger.v3.oas.annotations.media.Schema; | |||
import io.swagger.v3.oas.annotations.responses.ApiResponse; | |||
import io.swagger.v3.oas.annotations.security.SecurityRequirement; | |||
import io.swagger.v3.oas.annotations.tags.Tag; | |||
{{#hasAuthMethods}} |
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.
Should this be #hasExternalDocs
?
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.
Nice catch. I'll fix that.
…enerator : fix mustache template with #hasExternalDocs
…enerator: fix indentation
I'll we do that. For unit testing I've added an external docs to the
|
You need to run all of the following:
Otherwise tests will fail because the diffs won't match. |
…enerator: fix carriage return
…enerator: regenerate the spring-boot-oas3.yaml sample
I'll first generate the |
Generate all samples command looks like to failed on the master branch:
|
My guess is there's a serialized config file that needs to be updated because you added |
…enerator: generate-samples.sh
Just a human error. I've generated then commited all the samples. |
Hi @welshm, do you know if the core team members could have a look on my change to to |
I'll take another look today and then tag some of them |
@@ -170,7 +173,8 @@ public interface {{classname}} { | |||
{{#authMethods}} | |||
@SecurityRequirement(name = "{{name}}"{{#isOAuth}}, scopes={ {{#scopes}}"{{scope}}"{{^-last}}, {{/-last}}{{/scopes}} }{{/isOAuth}}){{^-last}},{{/-last}} | |||
{{/authMethods}} | |||
}{{/hasAuthMethods}} | |||
}{{/hasAuthMethods}}{{#hasExternalDocs}}, |
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.
Does this also work? I'm not an expert on mustache files, but I think you may not need the hasExternalDocs
boolean if you check if the parameter externalDocs
is set like this.
}{{/hasAuthMethods}}{{#externalDocs}},
externalDocs = @ExternalDocumentation(description = "{{externalDocs.description}}", url = "{{externalDocs.url}}")
{{/externalDocs}}
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.
For example, I see this in the Swift5 templates
{{#externalDocs}}
- externalDocs: {{.}}
{{/externalDocs}}
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 didn't know the mustache syntax but it may work. I will check tomorrow.
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've removed the hasExternalDocs
property. It's much simpler and the core classes are no more touched.
…enerator: remove hasExternalDocs
Still don't know why the
@welshm does it block my PR? |
Shouldn't block your PR |
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.
@wing328 will need to review and merge, but this looks great to me!
Thanks for adding the external docs!
@arey thanks for the PR but some CI tests failed: https://github.com/OpenAPITools/openapi-generator/actions/runs/3680159465/jobs/6327983250 can you please take a look when you've time? |
Thanks for the review @wing328 |
…enerator: generate-samples.sh
@wing328 I'll fixed the issue by systematically add the |
Any news? |
Thanks a lot William for this PR. And thank you for all the time you spent on this great project :) |
This Pull Request implements the feature describe in #14141 with a TDD approach.
It adds an
externalDocs
attribute to the@Operation
annotation regarding the operation yaml specification.PR checklist
master
(6.3.0) (minor release - breaking changes with fallbacks),7.0.x
(breaking changes without fallbacks)For JavaSpring comitttee
@cachescrubber (2022/02) @welshm (2022/02) @MelleD (2022/02) @atextor (2022/02) @manedev79 (2022/02) @javisst (2022/02) @borsch (2022/02) @banlevente (2022/02) @Zomzog (2022/09)
Core Team : @wing328 @jimschubert @cbornet @jmini @etherealjoy @spacether