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

Wrong parameter and method names generated for single quoted properties containing @ sign #9001

Open
jgrabowski opened this issue Dec 19, 2018 · 1 comment

Comments

@jgrabowski
Copy link

jgrabowski commented Dec 19, 2018

Description

Codegen on swaggerhub generates Jersey and Resteasy code that doesn't compile when properties contain '@' sign.
Codegen generates improper Java fields. Eg. for '@basetype' swagger property definition there is @basetype field name generated, and also getter/setter names are broken.

Swagger-codegen version

Not sure. The one from swagger.io.

Swagger declaration file content or url

I came across this issue while trying to implement TMF 655 Swagger API: https://raw.githubusercontent.com/tmforum-apis/TMF655_ChangeManagement/master/Change_Management.admin.swagger.json.

properties:
   '@baseType':
          type: string
          default: 'Attachment'
          description: The base type for use in polymorphic collections
Command line used for generation

Not applicable. I was using online codegen from swagger.io. I'll make tests on "standalone" version soon.

Steps to reproduce

Export -> Server stub -> jaxrs-jersey or jaxrs-resteasy

Related issues/PRs
Suggest a fix/enhancement

Codegen should "sanitize" such property names and exclude not allowed chars from field and getter/setter names. @JsonProperty annotation should be sufficient to reflect swagger contract for such properties.
I'll try to make a fix in codegen and post my solution soon.

@jgrabowski
Copy link
Author

It looks like it's already been fixed in master branch but it doesn't work for OpenAPI 3.0. Version from branch 3.0.0 still has described issue.

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

No branches or pull requests

1 participant