-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
[typescript-rxjs] Added support for servers #7771
[typescript-rxjs] Added support for servers #7771
Conversation
👍 Thanks for opening this issue! The team will review the labels and make any necessary changes. |
e5c81d2
to
2b41a6e
Compare
Will resolve the last problem, if PR is deemed okay -> it seems just the line endings are wrong (but if I run the bin/utils/ensure-up-to-date script I get several 100 files, but not the 4 files that are marked by the circleci: build). Probably because I run under windows in git bash. |
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.
Looks good, it would be nice if you could also port this to the new typescript
experimental generator
} | ||
|
||
{{#servers}} | ||
export const server{{-index}} = new ServerConfiguration<{ {{#variables}} "{{name}}": {{#enumValues}}"{{.}}"{{^-last}} | {{/-last}}{{/enumValues}}{{^enumValues}}string{{/enumValues}}{{^-last}},{{/-last}} {{/variables}} }>("{{url}}", { {{#variables}} "{{name}}": "{{defaultValue}}" {{^-last}},{{/-last}}{{/variables}} }, "{{description}}") |
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.
better only export the servers
variable
export const server{{-index}} = new ServerConfiguration<{ {{#variables}} "{{name}}": {{#enumValues}}"{{.}}"{{^-last}} | {{/-last}}{{/enumValues}}{{^enumValues}}string{{/enumValues}}{{^-last}},{{/-last}} {{/variables}} }>("{{url}}", { {{#variables}} "{{name}}": "{{defaultValue}}" {{^-last}},{{/-last}}{{/variables}} }, "{{description}}") | |
const server{{-index}} = new ServerConfiguration<{ {{#variables}} "{{name}}": {{#enumValues}}"{{.}}"{{^-last}} | {{/-last}}{{/enumValues}}{{^enumValues}}string{{/enumValues}}{{^-last}},{{/-last}} {{/variables}} }>("{{url}}", { {{#variables}} "{{name}}": "{{defaultValue}}" {{^-last}},{{/-last}}{{/variables}} }, "{{description}}") |
and add server
to the reserved keywords in
Lines 331 to 347 in 240c046
private void addExtraReservedWords() { | |
this.reservedWords.add("BASE_PATH"); | |
this.reservedWords.add("BaseAPI"); | |
this.reservedWords.add("COLLECTION_FORMATS"); | |
this.reservedWords.add("ConfigurationParameters"); | |
this.reservedWords.add("Configuration"); | |
this.reservedWords.add("HttpMethod"); | |
this.reservedWords.add("HttpHeaders"); | |
this.reservedWords.add("HttpQuery"); | |
this.reservedWords.add("HttpBody"); | |
this.reservedWords.add("RequestArgs"); | |
this.reservedWords.add("RequestOpts"); | |
this.reservedWords.add("ResponseArgs"); | |
this.reservedWords.add("Middleware"); | |
this.reservedWords.add("AjaxRequest"); | |
this.reservedWords.add("AjaxResponse"); | |
} |
to avoid naming conflicts with existing parameters
Is the experimental typescript generator -> this one here: https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/typescript/http/servers.mustache If so, it already has this feature, but slightly adjusted to their use case. (Other comment will be done.) |
2b41a6e
to
32e6b95
Compare
Anything else? (PS: If you have time, can you give me an idea if this generator will "die" and to be exchanged by the expermential one? Or point me to some infos about the idea of the experimental one) |
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.
LGTM
PR checklist
./bin/generate-samples.sh
to update all Petstore samples related to your fix. 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
Description of the PR
(if somebody could tell me, if typescript-rxjs is still a good idea to use or if the main typescript generator would be a better option (as it seems to use rxjs as well), I would highly appreciate it)
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)