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

[BUG][jaxrs-jersey][oas3] input with openapi spec v3 results in generated code with v2 annotations #1673

Closed
kingofdisasterr opened this issue Dec 14, 2018 · 2 comments

Comments

@kingofdisasterr
Copy link

kingofdisasterr commented Dec 14, 2018

Description

usage of the generator with:

-i modules/openapi-generator/src/test/resources/**3_0**/petstore-with-fake-endpoints-models-for-testing.yaml
-o samples/server/petstore/jaxrs-jersey

results in generated code with openapi spec v2 annotations.
i.e. samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/AnotherFakeApi.java:

@io.swagger.annotations.Api(description = "the another-fake API")

according to the openapi spec v3 it should result in:

@io.swagger.v3.oas.annotations.OpenAPIDefinition(info = @Info(title= "OpenAPI Petstore", description = "This spec is mainly for testing Petstore server and contains fake endpoints,
    models. Please do not use this for any other purpose. Special characters: "
    \", version = "1.0.0"))

if generating the html-documentation, the resulting yaml doesn't include all the information which was originally specified in the input yaml file.

openapi-generator version

openapi-generator version 3.3.4

OpenAPI declaration file content or url

from file: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml:

openapi: 3.0.0
info:
  description: >-
    This spec is mainly for testing Petstore server and contains fake endpoints,
    models. Please do not use this for any other purpose. Special characters: "
    \
  version: 1.0.0
  title: OpenAPI Petstore
Steps to reproduce

generate the JavaJaxRS sample

Suggest a fix

one of:

  • detection of input spec openapi version
  • change the default behavior of -g jaxrs-jersey to generate openapi v3 annotations
  • add a new language, i.e. -g jaxrs-jersey-v3
  • add a specific java related option like openAPIAnnotations=v3
@auto-labeler
Copy link

auto-labeler bot commented Dec 14, 2018

Thanks for opening this issue! I have applied any relevant labels.

@jmini
Copy link
Member

jmini commented Dec 17, 2018

This is a duplicate of #27.

I do not think that we need to support OpenAPI v2, but somebody needs to update the templates.

@jmini jmini closed this as completed Dec 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants