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

[Java][Native] Support oneOf/anyOf schemas #7263

Merged
merged 3 commits into from
Oct 15, 2020

Conversation

bgong-mdsol
Copy link
Contributor

Description of the PR

This PR includes

  • Add oneOf and anyOf implementation (based on java jersey2 approach)
  • re-generate sample projects of native/asyncNative
  • add a sample project for OneOf

@wing328 @sebastien-rosset @cbornet @jeff9finger @bbdouglas @sreeshas @jfiala @lukoyanov @karismann @Zomzog @lwlee2608 @bkabrda @jfeltesse-mdsol @jcarres-mdsol

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.
  • If contributing template-only or documentation-only changes which will change sample output, build the project beforehand.
  • Run the shell script ./bin/generate-samples.shto update all Petstore samples related to your fix. 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
  • Copy the technical committee to review the pull request if your PR is targeting a particular programming language.

}
{{/discriminator}}
{{#anyOf}}
// deserialzie {{{.}}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in 675545c

public {{classname}}() {
super("anyOf", {{#isNullable}}Boolean.TRUE{{/isNullable}}{{^isNullable}}Boolean.FALSE{{/isNullable}});
}
{{> libraries/jersey2/additional_properties }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jersey2 reference here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated in 675545c

private static JSON json;

static
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

elsewhere in the code the curly brace is on the same line as static

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated in 675545c

{{/additionalPropertiesType}}
{{/model}}
{{/models}}
{{^supportJava6}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this needed? unsure what it means actually but native == JDK 11

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed in 675545c

public {{classname}}() {
super("oneOf", {{#isNullable}}Boolean.TRUE{{/isNullable}}{{^isNullable}}Boolean.FALSE{{/isNullable}});
}
{{> libraries/jersey2/additional_properties }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here as well, jersey2

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated in 675545c

@bgong-mdsol bgong-mdsol force-pushed the feature/java-native-oneof branch 6 times, most recently from 6b04a39 to 6ac7aee Compare September 15, 2020 13:28
@bgong-mdsol
Copy link
Contributor Author

artifactId: petstore-openapi3-native-java8
hideGenerationTimestamp: true
serverPort: "8082"
dateLibrary: java8
Copy link
Member

@wing328 wing328 Sep 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bgong-mdsol I think you can remove this option as it makes no difference in the native library

For serverPort, I don't think it's used in the native template.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated as suggested in 0ddb2a9

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please resolve the merge conflicts? I'll try to review and merge if no question from me later this week.

@wing328 Sure, I am going to resolve the merge conflicts.

@@ -0,0 +1,12 @@
generatorName: java
outputDir: samples/openapi3/client/petstore/java/native-java8
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think native requires JDK11+ so I would remove java8 as it's a bit confusing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated as suggested in 0ddb2a9

@bgong-mdsol
Copy link
Contributor Author

Are there anything that I need to address before get this merged? Thanks

@wing328
Copy link
Member

wing328 commented Oct 14, 2020

Can you please resolve the merge conflicts? I'll try to review and merge if no question from me later this week.

@bgong-mdsol
Copy link
Contributor Author

@wing328 This PR is ready for review, thanks a lot

@wing328
Copy link
Member

wing328 commented Oct 15, 2020

Tests in Drone.io CI passed: https://cloud.drone.io/OpenAPITools/openapi-generator/11888

@wing328 wing328 merged commit edf153e into OpenAPITools:master Oct 15, 2020
jimschubert added a commit that referenced this pull request Oct 17, 2020
* master: (66 commits)
  [Typescript][Angular] Fix generated README when using apiModulePrefix (#7725)
  remove outdated scala files (#7723)
  [FEAT][TYPESCRIPT-ANGULAR] Add configurationPrefix option to allow generating unique configuration token (#7731)
  [bug] Fix FILES sort and path provider issue (#7729)
  better csharp tests (#7727)
  [go] Improve examples generation (#7576)
  Fixes #7635: typescript-inversify generator wrongly handles array type parameters (#7636)
  [Java] Fix import mapping for arrays with reference items of type string (#7182)
  [Java][Native] Support oneOf/anyOf schemas (#7263)
  [BUG][Ada] Incorrect client Ada code generated (#7719)
  add cake, sbt integration (#7713)
  Use 3.0 spec in documentations, update docs  (#7710)
  remove github.com/antihax/optional from go.sum (#7692)
  Update junit to newer version (4.13.1) (#7690)
  [Fix/Dart2] Resolve an exception with status 204 and no body. (#7647)
  [typescript-angular] pass array as a single JSON string to url query when queryParamObjectFormat=json (fix #7620) (#7649)
  Add back HttpSigningConfiguration.cs
  remove HTTPSigningConfiguration.cs
  add AnyType support to Swift generators (#7644)
  fix warning, remove trailing spaces (#7659)
  ...
@bgong-mdsol bgong-mdsol deleted the feature/java-native-oneof branch November 25, 2020 00:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants