Skip to content

Generating with attribute example in swagger.json #469

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

Closed
mari70 opened this issue Mar 4, 2015 · 5 comments
Closed

Generating with attribute example in swagger.json #469

mari70 opened this issue Mar 4, 2015 · 5 comments
Labels
Milestone

Comments

@mari70
Copy link

mari70 commented Mar 4, 2015

Hello,

when trying to generate JAX-RS 2.0 code (based on swagger 2.0) it fails as soon as in the definitions part of swagger file an attribute "example" is used. The attribute example itself works fine when using the swagger editor.

 "Gateway": {
        "properties": {
            "gatewayId": {
                "type": "string",
                "description": "The unique id of abc."
            }
        },
        "example": {
            "gatewayId": "abc"
        }
    },

I used swagger-codegen-distribution-2.1.2-M1.jar
Any idea?

@fehguy
Copy link
Contributor

fehguy commented Mar 4, 2015

Do you get an error message? Please share it if so and if possible, grab the 2.1.3-SNAPSHOT from sonatype or the develop_2.0 branch

@mari70
Copy link
Author

mari70 commented Mar 4, 2015

This is the error message:
Can not deserialize instance of java.lang.String out of START_OBJECT token
at [Source: N/A; line: -1, column: -1](through reference chain: com.wordnik.sw
agger.models.ModelImpl["example"]) (through reference chain: com.wordnik.swagger
.models.Swagger["definitions"])
reading from test/in/swagger.json
Can not deserialize instance of java.lang.String out of START_OBJECT token
at [Source: N/A; line: -1, column: -1](through reference chain: com.wordnik.sw
agger.models.ModelImpl["example"]) (through reference chain: com.wordnik.swagger
.models.Swagger["definitions"])

I will try the snapshot later.

@fehguy
Copy link
Contributor

fehguy commented Mar 4, 2015

Thanks, will add a test for this and see about getting it fixed.

@fehguy fehguy added this to the v2.1.0-M2 milestone Mar 4, 2015
@fehguy fehguy added the P1 label Mar 12, 2015
@lugaru1234
Copy link
Contributor

I tried to reproduce this bug from both master and develop_2.0 branches with this json sample but it works fine. Could you please tell me where to reproduce this bug?

@fehguy
Copy link
Contributor

fehguy commented Apr 21, 2015

confirmed fixed in develop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants