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

jmini
Copy link
Member

@jmini 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
Copy link
Contributor

@ackintosh ackintosh left a comment

Choose a reason for hiding this comment

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

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();
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the follow-up!

@jmini jmini merged commit 1f1a47c into OpenAPITools:master Jun 30, 2018
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.

None yet

2 participants