Skip to content

Conversation

@karzang
Copy link
Contributor

@karzang karzang commented Nov 3, 2022

As described in #12556 it is not possible to use schemas with primitive types or schemas of array type since the java client generator does only support schemas of type 'object' in oneOf. This change supports the use of primitives and arrays in oneOf without the need to wrap them into objects.

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 (6.1.0) (minor release - breaking changes with fallbacks), 7.0.x (breaking changes without fallbacks)
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

@bbdouglas (2017/07) @sreeshas (2017/08) @jfiala (2017/08) @lukoyanov (2017/09) @cbornet (2017/09) @jeff9finger (2018/01) @karismann (2019/03) @Zomzog (2022/09) @lwlee2608 (2019/10)

@cachescrubber (2022/02) @welshm (2022/02) @MelleD (2022/02) @atextor (2022/02) @manedev79 (2022/02) @javisst (2022/02) @borsch (2022/02) @banlevente (2022/02)

@dinuta
Copy link

dinuta commented Jan 31, 2023

Hi team, Do you need additional checks on this ?

If you can provide a snapshot I can validate also.

@wing328
Copy link
Member

wing328 commented Jan 31, 2023

@dinuta please bulid the JAR locally to help test this PR.

git checkout -b karzang-issue_12556 master
git pull https://github.com/karzang/openapi-generator.git issue_12556
mvn clean package -DskipTests -Dmaven.javadoc.skip=true

then run you tests with modules/openapi-generator-cli/target/openapi-generator-cli.jar

@dinuta
Copy link

dinuta commented Feb 1, 2023

Hi team,

Made 1 test with the following config (to generate a client consumer):
{
...
"library": "rest-assured",
"serializationLibrary": "jackson"
...
}

The classes seems fine, but there aren't the swagger annotations on the api classes as per 6.2.1 version:
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;

Example annotations:
@ApiModelProperty(value = "The name of the files to pick up.")
@Api(value = "SomeApiProfiles")

It might not be so relevant for the issue, but I'll try to generate for okhttp3 with gson also. Don't know when I'll finish.

Any questions ? Thoughts?

@karzang
Copy link
Contributor Author

karzang commented Apr 25, 2023

@dinuta @wing328 Has this PR a chance of being merged soon?

@wing328
Copy link
Member

wing328 commented Apr 25, 2023

@karzang sorry for the delay. can you please PM me via Slack https://join.slack.com/t/openapi-generator/shared_invite/zt-12jxxd7p2-XUeQM~4pzsU9x~eGLQqX2g to quickly walk through this PR?

Copy link
Member

Choose a reason for hiding this comment

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

FYI @OpenAPITools/generator-core-team

@wing328 wing328 modified the milestones: 6.6.0, 7.0.0 May 11, 2023
@karzang karzang marked this pull request as draft May 31, 2023 11:38
@karzang karzang marked this pull request as ready for review June 5, 2023 15:45
Copy link
Member

Choose a reason for hiding this comment

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

can you please merge the latest master into your branch if you've not yet done so?

this file shouldn't be generated in the latest master.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i rebased on top of the master but the existing samples were not deleted when calling ./bin/generate-samples.sh

I removed some samples that were falsely generated. Please let me know if you find more files which should not be generated.

@karzang karzang marked this pull request as draft June 28, 2023 14:31
@karzang karzang marked this pull request as ready for review June 28, 2023 15:11
@wing328 wing328 merged commit e9d9866 into OpenAPITools:master Jun 29, 2023
@wing328 wing328 changed the title [Java][Client] Fix #12556 Support primitives and arrays in oneOf [Java][Client] Support primitives and arrays in oneOf Jun 29, 2023
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.

3 participants