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

[OCaml] Added optional params support in API operations #3568

Merged
merged 11 commits into from
Aug 7, 2019

Conversation

cgensoul
Copy link
Contributor

@cgensoul cgensoul commented Aug 6, 2019

Added optional params support in API operations

This PR translates optional OpenAPI operation parameters into optional OCaml function parameters. To allow more flexible use of generated API functions, all function parameters are now named (even the required ones).

Default values given for API operation parameters are also turned into default values for corresponding parameters of OCaml generated API function. Default values are also automatically generated for parameters that are of an enum type with a uniq enum case (useless parameter since it's value is constant but encountered...).

A bug has been fixed in path param replacement.
Reformatted api-impl template to make it easier to read.

@wing328
Copy link
Member

wing328 commented Aug 7, 2019

Reformatted api-impl template to make it easier to read.

Shall we use something like ocamlformat to auto-format the auto-generated code?

We can add post-processing file hook to allow any code formatter to format the code based on user preference.

@wing328 wing328 merged commit 411199b into OpenAPITools:master Aug 7, 2019
@cgensoul
Copy link
Contributor Author

cgensoul commented Aug 7, 2019 via email

@cgensoul
Copy link
Contributor Author

cgensoul commented Aug 7, 2019 via email

@wing328
Copy link
Member

wing328 commented Aug 8, 2019

It's not in my priorities at the moment though.

I've filed #3583 to allow file post processing in the OCaml client generator

jimschubert added a commit that referenced this pull request Aug 11, 2019
* master: (122 commits)
  Fix #3604 by adding undefined as return type to headers and credentials methods in runtime.ts (#3605)
  Prepare 4.1.1-SNAPSHOT (#3603)
  Prepare 4.1.0 release (#3597)
  [java][client][jax-rs] Add a constant for Jackson @JsonProperty (#3560)
  restore openapi3 petstore.yaml (#3590)
  Add a new NodeJS Express server generator (#3567)
  [C#][client][csharp-netcore] Fix csharp netcore defaultheaders (#3562)
  Fix issue deserializing to nullptr (#3572)
  [OCaml] Add file post-processing (#3583)
  [dart2] Fix up test code generation, double deserialization, 'new' keyword deprecation (#3576)
  Run Qt5 client sample test (#3415)
  typescript-fetch: allow configuration of headers and credentials (#3586)
  using partials in ruby api_client (#3564)
  [OCaml] Added optional params support in API operations (#3568)
  [Rust Server] Generate valid Rustdocs for lazy_static items (#3556)
  Fix NPM build for Typescript-fetch (#3403)
  Expand path templates via resttemplate's uriTemplateHandler (#3500)
  Readme updated with a new tutorial and company using OpenAPI Generator (#3566)
  Fix logic of `getNullableType` of csharp server and client. (#3537)
  [Ruby] clean up Ruby dev dependencies (#3551)
  ...
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

2 participants