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

Obtain the example value from examples #419

Merged
merged 3 commits into from Jun 30, 2018

Conversation

Projects
None yet
2 participants
@jmini
Copy link
Member

jmini commented Jun 29, 2018

PR checklist

  • Read the contribution guidelines.
  • Ran the shell script under ./bin/ to update Petstore sample so that CIs can verify the change. (For instance, only need to run ./bin/{LANG}-petstore.sh and ./bin/security/{LANG}-petstore.sh if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in .\bin\windows\.
  • Filed the PR against the correct branch: master, 3.1.x, 4.0.x. Default: master.
  • Copied the technical committee to review the pull request if your PR is targeting a particular programming language. @OpenAPITools/generator-core-team

Description of the PR

After #183 made by @ackintosh, I think it would also be good to support examples in addition to example (in a similar way).

If both (example and examples properties) are set, we keep the example value, if multiple examples are set we keep the first one.

In the future we might want to update codegen classes so that they support multiple examples values (OAS3 feature)

@jmini jmini added this to the 3.1.0 milestone Jun 29, 2018

@ackintosh
Copy link
Member

ackintosh left a comment

LGTM 👍

}

@Test
public void testExample4() {
final OpenAPI openAPI = new OpenAPIParser().readLocation("src/test/resources/3_0/examples.yaml", null, new ParseOptions()).getOpenAPI();
final DefaultCodegen codegen = new DefaultCodegen();

Operation operation = openAPI.getPaths().get("/example4").getGet();
Operation operation = openAPI.getPaths().get("/example4/singular").getPost();

This comment has been minimized.

@ackintosh

ackintosh Jun 30, 2018

Member

Thanks for the follow-up!

@jmini jmini merged commit 1f1a47c into OpenAPITools:master Jun 30, 2018

3 of 4 checks passed

Shippable Run 1096 status is FAILED.
Details
ci/circleci Your tests passed on CircleCI!
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.