-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Documentation of Configuration/ConfigurationParameter for consolidated TypeScript generator #10283
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
Conversation
This is great @TiFu thank you. Two comments:
|
The spec is the OpenAPI file that you use to generate the code, @rgomezp . |
const config = your_api.createConfiguration(configurationParameters); | ||
|
||
// Use configuration with your_api | ||
const api = new your_api.PetApi(config); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be great to also see how you would make a call off of this api
instance.
It seems like we'd do something like api.getUsers()
, but I'm getting tripped up by POST requests.
It seems like you'd do something like:
// Seems like object arguments need to be namespaced, and that's based on the model name?
// If there's an option to not-namespace params I'd love to know it
api.createUser({createUserRequest: { email: 'email', password: 'password'}})
This seems to work for me if the SDK is making a call from one localhost port to another, but in my prod env it strips out the request payload. I imagine that's because I'm missing some kind of config option, and seeing how you do this would be super helpful information.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added another couple lines with an example in the latest commit. Hope that explains it a bit more. There's also some examples in the tests
folder under samples/openapi3/client/petstore/typescript/
- hope this helps with debugging your problem.
943a3dd
to
be67222
Compare
Failures are unrelated. Given that this only touches files in the consolidated typescript generator & only changes comments, will go ahead and merge this. |
As requested by @rgomezp in #6341, I have added a bit more elaborate comments on the
ConfigurationParameters
andConfiguration
objects.Just an initial draft for now, but happy to already get some feedback on how we can further improve the documentation to make it more user-friendly.
PR checklist
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.
master
(5.3.0),6.0.x
CC @TiFu (2017/07) @taxpon (2017/07) @sebastianhaas (2017/07) @kenisteward (2017/07) @Vrolijkx (2017/09) @macjohnny (2018/01) @topce (2018/10) @akehir (2019/07) @petejohansonxo (2019/11) @amakhrov (2020/02)