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

[JAXRS-spec] Add option useSwaggerAnnotations (for MicroProfile-OpenAPI) #813

Merged
merged 14 commits into from
Aug 15, 2018
Merged

[JAXRS-spec] Add option useSwaggerAnnotations (for MicroProfile-OpenAPI) #813

merged 14 commits into from
Aug 15, 2018

Conversation

michbeck100
Copy link
Contributor

PR checklist

  • Read the contribution guidelines.
  • Ran the shell script under ./bin/ to update Petstore sample so that CIs can verify the change. (For instance, only need to run ./bin/{LANG}-petstore.sh and ./bin/security/{LANG}-petstore.sh if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in .\bin\windows\.
  • Filed the PR against the correct branch: master, 3.3.x, 4.0.x. Default: master.
  • Copied the technical committee to review the pull request if your PR is targeting a particular programming language.

Description of the PR

The Microprofile OpenAPI specification allows to have just a static openapi.yaml file in the application module’s root META-INF folder (see here). So this PR adds an additional property "useSwaggerAnnotations" that doesn't generate the Swagger annotations if set to false (default value is true for backward compatibility).

This way you can easily generate code that conforms to contract first and is compliant with the microprofile openapi specification

@michbeck100 michbeck100 changed the title Filter swagger annotations [JAXRS-spec] Filter swagger annotations for OpenAPI compatibility Aug 14, 2018
@jmini
Copy link
Member

jmini commented Aug 15, 2018

Thank you for this PR. I like your approach.

Shippable — Run 2208 status is FAILED.

The Shippable CI Job ensure that the content of the samples/ folder correspond to the state of the generator. Can you please update it?

  • Run mvn to update the cli
  • Run the scripts to udpate the outdated samples:
    • bin/jaxrs-cxf-cdi-petstore-server.sh to update samples/server/petstore/jaxrs-cxf-cdi
    • bin/jaxrs-spec-petstore-server-interface.sh to update samples/server/petstore/jaxrs-spec-interface
    • bin/jaxrs-spec-petstore-server.sh to update samples/server/petstore/jaxrs-spec
  • add the changes as new commit in this PR (we will squash all small commit of the PR as one single commit when we merge it)

See also: https://github.com/OpenAPITools/openapi-generator/wiki/Pull-Request-Checklist#shippable-ensure-up-to-date

@michbeck100
Copy link
Contributor Author

I just ran bin/jaxrs-spec-petstore-server.sh, my fault. How can one know which scripts to run?

@jmini
Copy link
Member

jmini commented Aug 15, 2018

I once generated this table: https://github.com/OpenAPITools/openapi-generator/wiki/Samples-folder#scripts (might be outdated)

I have computed the list for your by looking at the Shippable error report.

If you have time (takes some minutes), you can also run bin/utils/ensure-up-to-date locally.

@michbeck100
Copy link
Contributor Author

I had to fix some missing imports in efe7014. BTW: it seems that before 82eba8d this wan't working at all. And i don't really know what this is good for.

@jmini jmini merged commit fa52826 into OpenAPITools:master Aug 15, 2018
@jmini
Copy link
Member

jmini commented Aug 15, 2018

Thank you a lot for this contribution

@jmini jmini added this to the 3.2.2 milestone Aug 15, 2018
@jmini jmini changed the title [JAXRS-spec] Filter swagger annotations for OpenAPI compatibility [JAXRS-spec] Add option useSwaggerAnnotations (for MicroProfile-OpenAPI) Aug 15, 2018
@michbeck100 michbeck100 deleted the filter_swagger_annotations branch August 16, 2018 06:28
@wing328
Copy link
Member

wing328 commented Aug 22, 2018

@michbeck100 thanks for the enhancement, which is included in the v3.2.2 stable release: https://twitter.com/oas_generator/status/1032252335131512832

A-Joshi pushed a commit to ihsmarkitoss/openapi-generator that referenced this pull request Feb 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants