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

[SWAGGER-YAML] unexpected example on models #8712

Closed
HugoMario opened this issue Sep 18, 2018 · 2 comments
Closed

[SWAGGER-YAML] unexpected example on models #8712

HugoMario opened this issue Sep 18, 2018 · 2 comments
Assignees
Milestone

Comments

@HugoMario
Copy link
Contributor

HugoMario commented Sep 18, 2018

Description

example fields are added on definition inside the swagger and swagger-yaml generator output

Swagger-codegen version

2.X

Swagger declaration file content or url
paths:
  /foo:
    post:
      parameters:
        - in: body
          name: body
          schema:
            $ref: '#/definitions/BodyParam'
      responses:
        200:
          description: OK
          schema:
            $ref: '#/definitions/OKResponse'
        400:
          description: Error
          schema:
            $ref: '#/definitions/ErrorResponse'

definitions:
  BodyParam:
    type: object
    properties:
      foo:
        type: string
  OKResponse:
    type: object
    properties:
      bar:
        type: string
  ErrorResponse:
    type: object
    properties:
      error:
        type: integer
      message:
        type: string
    required:
      - error
      - message
Command line used for generation
java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate -l swagger -i definition.yaml -o output
Suggest a fix/enhancement

This issue is happening because codegen handles operations and add examples to parameters, even if these operation are not going to be used in generator. it's just its default behave. So to fix this we just need to disable the apis generation for swagger and swagger-yaml generator, which is actually not required.

@HugoMario HugoMario added this to the v3.0.1 milestone Sep 18, 2018
@HugoMario HugoMario self-assigned this Sep 18, 2018
@HugoMario
Copy link
Contributor Author

PR #8713 has been added to fix this on swagger-codegen 2.0

@HugoMario HugoMario modified the milestones: v3.0.1, v2.4.0 Sep 18, 2018
@HugoMario
Copy link
Contributor Author

this has been fixed with #8713 and #8716

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

1 participant