-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…t = false }. It allows receiving more fields in the JSon payload than declared in the OCaml record, fields not matching any record field are ignored.
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. |
Yes we could, I agree that users might want to format it so that it follows
some internal company and/or project guidelines.
It's not in my priorities at the moment though. The goal of the commit you
referenced was simply to make it easier for me to modify the code of the
template (I was unaware of the jMustache rule by which begin/end mustache
tags alone on their line don't generate line breaks in the output, and I
took advantage of that rule as soon as I learned about it).
As far as I am concerned, both the template and the generated code are
quite easy to read now.
…On Wed, Aug 7, 2019 at 5:23 AM William Cheng ***@***.***> wrote:
Reformatted api-impl template to make it easier to read.
Shall we use something like ocamlformat
<https://github.com/ocaml-ppx/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.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#3568?email_source=notifications&email_token=AMWCGNWQ7LDXPHYEH3ECOBDQDI53XA5CNFSM4IJUPYT2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3XCOYI#issuecomment-518924129>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AMWCGNXJURTPUKKDTF2JKL3QDI53XANCNFSM4IJUPYTQ>
.
|
Thanks for the merge ! I think optional parameters was quite an important
feature to have, it makes the generated API functions much nicer to use and
document them at the same time (since function arguments are all named now).
…On Wed, Aug 7, 2019 at 5:25 AM William Cheng ***@***.***> wrote:
Merged #3568 <#3568>
into master.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#3568?email_source=notifications&email_token=AMWCGNWJIIUK5I4KLNIKG43QDI6DHA5CNFSM4IJUPYT2YY3PNVWWK3TUL52HS4DFWZEXG43VMVCXMZLOORHG65DJMZUWGYLUNFXW5KTDN5WW2ZLOORPWSZGOS5ISEEQ#event-2538676754>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AMWCGNRR2ZYWJZP2YI4VNWLQDI6DHANCNFSM4IJUPYTQ>
.
|
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.