Skip to content

Conversation

@benfonty
Copy link
Contributor

When additional properties is true, use an additionalProperties attribute and @JsonAnySetter and @JsonAnyGetter instead of inherit from Map. I followed what was done for java.jersey2 in #6518.

This fixes #1466 only for spring target.

cc @nmuesch

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    ./mvnw clean package 
    ./bin/generate-samples.sh
    ./bin/utils/export_docs_generators.sh
    
    Commit all changed files.
    This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
    These must match the expectations made by your contribution.
    You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*.
    For Windows users, please run the script in Git BASH.
  • File the PR against the correct branch: master (5.3.0), 6.0.x
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

@bfrggit
Copy link

bfrggit commented Nov 4, 2021

Q1: What if additionalProperties is not boolean, (i.e., the additional properties have a certain type of values)? Does this also work?
Q2: Can this be done for the Java generator too?

@benfonty
Copy link
Contributor Author

benfonty commented Nov 7, 2021

Q1: What if additionalProperties is not boolean, (i.e., the additional properties have a certain type of values)? Does this also work?

Yes, if the type is string for example, additionalAttributes has type Map<String, String> instead of Map<String, Object>.

Q2: Can this be done for the Java generator too?

This can be done for all java generators, but the code might differ from generator to generator, as the template are not always the same. quote https://github.com/OpenAPITools/openapi-generator/pull/6518/files#diff-e939f76e33b14e4de9645853ba5bdeb050b5fa0b6676693ff900fd60aaf08528R375

@benfonty benfonty force-pushed the fix_issue1466_spring branch from be1ba96 to 9b64429 Compare November 7, 2021 12:37
@jameswynn
Copy link
Contributor

The failed bitrise test looks like an intermittent failure. Is that all that is blocking this PR?

@benfonty
Copy link
Contributor Author

The failed bitrise test looks like an intermittent failure. Is that all that is blocking this PR?

I don't know. There were two failed builds with the same error that seems indeed intermittent. I am not sure what to do to fix it.

@jameswynn
Copy link
Contributor

@cbornet The normal build passes, but bitrise chokes. Any advice?

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

Successfully merging this pull request may close these issues.

[java] Combining "properties" and "additionalProperties" in one class generates broken Jackson mapping.

3 participants