Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

java: Parameter keys are not escaped properly #459

Closed
lorenzleutgeb opened this issue Jul 4, 2018 · 3 comments
Closed

java: Parameter keys are not escaped properly #459

lorenzleutgeb opened this issue Jul 4, 2018 · 3 comments

Comments

@lorenzleutgeb
Copy link

Description

Note the | character in the parameter key. This translates to:

  public static final String SERIALIZED_NAME_UPDATED_AT|GT = "updated_at|gt";
  @SerializedName(SERIALIZED_NAME_UPDATED_AT|GT)
  private OffsetDateTime updatedAt|gt = null;

... which does not parse as Java.

openapi-generator version

020883f

OpenAPI Declaration
paths:
  '/foo':
    get:
      parameters:
        - name: filter
          in: query
          required: false
          style: deepObject
          schema:
            properties:
              "updated_at|gt":
                type: string
                format: date-time
Command Line used for generation
java -jar openapi-generator-cli.jar generate -l java -i api.yml -o jclient
Steps to reproduce

Generate client.

Related issues/PRs

None.

Suggest a fix/enhancement

Escape parameter names properly such that the generator emits syntactically valid Java code.

@jmini
Copy link
Member

jmini commented Jul 4, 2018

Thank you a lot for this issue. Have you the possibility to check the patch I have proposed in #461?

@lorenzleutgeb
Copy link
Author

Yes, I checked and the fix works for me. Thank you!

@jmini
Copy link
Member

jmini commented Jul 5, 2018

This is fixed in 3.1.0-SNAPSHOT (release is planned tomorrow)

@jmini jmini closed this as completed Jul 5, 2018
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants