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

[TS][Inverisify] Adding support for RxJS 6 #2793

Merged
merged 11 commits into from May 27, 2019

Conversation

gualtierim
Copy link
Contributor

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, ./bin/openapi3/{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.4.x, 4.0.x. Default: master.
  • Copied the technical committee to review the pull request if your PR is targeting a particular programming language.

Description of the PR

Adding support to rxjs6 and patch http method for typescript-inverisify's language

@gualtierim
Copy link
Contributor Author

import 'rxjs/add/operator/toPromise';
import { Observable } from 'rxjs/Observable';

import { map } from 'rxjs/operators';
Copy link
Member

Choose a reason for hiding this comment

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

I think map should be added to the reserved keywords

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I used the standard import of map operator of rxjs as suggested in the documentation.

Copy link
Member

Choose a reason for hiding this comment

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

yes, but if a user defines an api parameter named map, this clashes, so we should add map to the list of reserved keywords, similar to this:

reservedWords.addAll(Arrays.asList(
// local variable names used in API methods (endpoints)
"varLocalPath", "queryParameters", "headerParams", "formParams", "useFormData", "varLocalDeferred",
"requestOptions",
// Typescript reserved words
"abstract", "await", "boolean", "break", "byte", "case", "catch", "char", "class", "const", "continue", "debugger", "default", "delete", "do", "double", "else", "enum", "export", "extends", "false", "final", "finally", "float", "for", "function", "goto", "if", "implements", "import", "in", "instanceof", "int", "interface", "let", "long", "native", "new", "null", "package", "private", "protected", "public", "return", "short", "static", "super", "switch", "synchronized", "this", "throw", "transient", "true", "try", "typeof", "var", "void", "volatile", "while", "with", "yield"));

Copy link
Contributor Author

@gualtierim gualtierim May 8, 2019

Choose a reason for hiding this comment

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

I thought you refered to the reserved key keywords of javascript and I could not understand you. Thanks for the example. I added map to reserved keywords.

Copy link
Member

Choose a reason for hiding this comment

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

I've filed #3020 to rename "map" to "GlobalImportOperators" so that map doesn't need to be a reserved word.

import { Observable } from "rxjs/Observable";

{{^useRxJS6}}
import { Observable } from 'rxjs/Observable';
Copy link
Member

Choose a reason for hiding this comment

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

i suggest to use double quotes as in the rest of the code

@@ -28,7 +28,12 @@
"@angular/compiler": "^{{ngVersion}}",
"core-js": "^2.4.0",
"reflect-metadata": "^0.1.3",
"rxjs": "^{{rxjsVersion}}"
{{^useRxJS6}}
Copy link
Member

Choose a reason for hiding this comment

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

why is this changed? it is not related to typescript-inversify

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added a config's propertyuseRxJS6 to allow the user to decide the using of rxjs6 or rxjs5

Copy link
Member

Choose a reason for hiding this comment

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

here you are modifying the typescript-angular file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, I did a big mistake

@gualtierim
Copy link
Contributor Author

@macjohnny In the list of api client the typescript-inversify is not listed. Please can you insert it?

@macjohnny
Copy link
Member

@gualtierim which list do you mean? you can add it yourself as part of this PR if you find the corresponding file.

Add typescript-inversify inside README
@gualtierim gualtierim force-pushed the typescript-inverisify-rxjs6 branch from eeeca91 to ed34de6 Compare May 8, 2019 13:29
@wing328 wing328 changed the title Typescript inverisify rxjs6 [TS][Inverisify rxjs6 May 27, 2019
@wing328 wing328 changed the title [TS][Inverisify rxjs6 [TS][Inverisify] Adding support for rxjs6 May 27, 2019
@wing328 wing328 changed the title [TS][Inverisify] Adding support for rxjs6 [TS][Inverisify] Adding support for RxJS 6 May 27, 2019
@wing328 wing328 merged commit 50878fb into OpenAPITools:master May 27, 2019
@wing328
Copy link
Member

wing328 commented Jun 3, 2019

@gualtierim thanks again for your contribution, which has been included in the v4.0.1 release (https://twitter.com/oas_generator/status/1135534738658062336)

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

3 participants