-
-
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
[Typescript Fetch] New optional mode with redux saga & immutablejs (saga & records) #8578
[Typescript Fetch] New optional mode with redux saga & immutablejs (saga & records) #8578
Conversation
…mustache test file.
Sync with latest openapi master
…utablejs # Conflicts: # modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenModel.java # modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java # modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java # modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java # modules/openapi-generator/src/main/resources/typescript-fetch/models.index.mustache # modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptFetchClientOptionsProvider.java # modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/fetch/TypeScriptFetchClientOptionsTest.java
…Model used exclusively by TypescriptFetchClient. Adding missing samples files.
…egenOperation used exclusively by TypescriptFetchClient.
…genProperty used exclusively by TypescriptFetchClient.
…egenParameter used exclusively by TypescriptFetchClient.
…l concept of "operation return passthrough"
…dependencies in models and other special cases. Also fixed issues with default values for some records properties.
…s in some cases. Fix issues with enum default values.
…s in some cases. Fix issues with enum default values.
merge latest openapi
… that cannot be used in Records. Added missing export to record: toApi().
…uilt-in "reserved words" feature. Fix minor issues with typings in generated files.
…licts. Added generated ApiEntities (record, reducer & selector) files.
Merge openapi master
Looks like some changes are using tab instead of spaces. Please have a look. |
Please run |
merge master
…lysis time for consuming project. Removed tab characters in mustache files. Reformat code for TypeScriptFetchClientCodegen to try to remove false positive for tabs vs spaces.
…pt version to address some typing errors on library build.
… ensure proper typechecking info is generated.
…t to convert an entity to an inlined model recursively.
merge original
…utablejs # Conflicts: # modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java
This reverts commit ea9b4ae
@wing328 Can you please merge this!? I finally managed to pass all the checks!! (the travis-ci check has an error only because of the docker rate limitting problem, but I know that it also passes successfully) |
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) for another review. |
@@ -0,0 +1,16 @@ | |||
generatorName: typescript-fetch | |||
outputDir: samples/client/petstore/typescript-fetch/builds/sagas-and-records | |||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing-saga-and-records.yaml |
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.
Can we use OpenAPI 3.0 spec instead as we're doing the same for other samples from openapi 2.0 to 3.0 spec?
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.
If this can wait, I would prefer to take a look at this at a later time. I am not sure of the implications of changing this. It is probably very easy, but I am not sure. Would prefer to proceeed with a first merge and upgrade in a next phase. See my additional comments below regarding the futur plan for this upgrade.
I noticed lots of new functions/codes are added to |
Here is some additional information about this upgrade: This upgrade is almost a new generatror. It will generate files for supporting immutablejs data structure and redux-saga patterns. This is built on-top of typescript files generated. It is currently packaged together with typescript fetch because this was the easiest way obtain a fully working generator by leveraging the existing generated code and adding another layer on top of it. It is also usefull for any code base, like ours, that wants to transition to the new layer. Some of our code still uses the original typescript fetch layer (which remains unchanged) and we can progressively transition to the saga&recopr layer since both are outputted when using the sagaAndRecord flag. In a subsequent phase, I plan to create a fully stand alone generator that will only generate files needed for the saga&record layer directly (with a little bit of low level code using fetch, similar to what typesdcript fetch uses). But this might be a huge task, so we are proceeding with this intermediate step for now. This upgrade is completely backward compatible and 100% optional: I did not modified the behavior of typescript fetch in any way whatsoever. Great care was taken to wrap all potential changes with a "if (sageAndRecord)", please tell me if you see a problem somewhere! I do not want to affect the existing typescript fetch. If the saga&recor switch is "false" typescript fetch should behave exactly as before with zero changes. |
BTW, we have been testing the saga&record output for the last several months in our production code base now and it works really well. We made a few tweaks here and there along the way. The code and its output is now pretty stable. I am hoping we can merge this as-is if no issues are found and then we can proceed in a more incremental way for future changes. My intention is definitively to add more comments throught the code, and potentially eventually split this in a new generator. Rest assured, I intend to support this for the foreseeable future. |
I restarted the build, lets see if it succeeds. Then we could merge it (although I didnt have a detailed look at the code) |
Alright, standing by to fix any issues if something goes wrong... |
@macjohnny I think we are good to go... ? |
Hello @macjohnny or @wing328 , I have been waiting for a while for this to be merged... Could you please try to merge this when you have time. Thank you! |
Added new generation mode for typescript fetch to support saga & records.
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.1.x
,6.0.x
@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)