-
-
Notifications
You must be signed in to change notification settings - Fork 7.1k
feat(typescript-fetch): add docs support #21719
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
base: master
Are you sure you want to change the base?
Conversation
@@ -73,6 +73,8 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege | |||
protected boolean withoutRuntimeChecks = false; | |||
protected boolean stringEnums = false; | |||
protected String fileNaming = PASCAL_CASE; | |||
protected String apiDocPath = "docs/"; |
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.
Should these use File.separator
as well?
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've removed the trailing slash here and added it in the web context (readme and docs files).
@@ -316,6 +331,16 @@ public void processOpts() { | |||
setGenerateValidationAttributes(convertPropertyToBooleanAndWriteBack(VALIDATION_ATTRIBUTES)); | |||
} | |||
|
|||
@Override | |||
public String apiDocFileFolder() { | |||
return (outputFolder + File.separator + apiDocPath); |
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.
...because we seem to be using those constantly here for a local path. If we want to use the constants both in a file path context and a web context we should remove the trailing slash and add it when we use them in a web context.
d9903a4
to
ab65d6f
Compare
- generate-samples.sh - export_docs_generators.sh
ab65d6f
to
0d17ea2
Compare
embeddedTemplateDir = templateDir = "typescript-fetch"; | ||
|
||
this.apiTemplateFiles.put("apis.mustache", ".ts"); | ||
this.modelTemplateFiles.put("models.mustache", ".ts"); |
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.
How will this interact with the withoutRuntimeChecks
configuration property?
It looks like if this option is enabled models.mustache
was not included in the modelTemplateFiles
. See code here
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.
Thank you - I'll push an update to exclude model docs when this option is enabled, matching the behavior of models.mustache
, and also ensure this is handled in the api and readme docs.
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.
What I ended up doing is generating model documentation whether or not withoutRuntimeChecks
is enabled. It's helpful to see what input / output is expected, even if runtime checks are not enabled.
Currently, the
typescript-fetch
client does not support generation of documentation. This PR adds documentation generation support and improves the generated package README.fixes #18276
closes #18351 (abandoned)
To validate,
bin/generate-samples.sh bin/configs/typescript-fetch-*.yaml
typescript-fetch
README.md (samples/client/petstore/typescript-fetch/builds/es6-target/README.md
and click around to view the new readme, generated API documentation, model documentation and examples.typescript-fetch
integration tests:./mvnw integration-test -f samples/client/petstore/typescript-fetch/tests/default/pom.xml
Committee mentions
@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) @davidgamero (2022/03) @mkusaka (2022/04) @joscha (2024/10)
PR checklist
Commit all changed files.
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*
.IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
master
(upcoming7.x.0
minor release - breaking changes with fallbacks),8.0.x
(breaking changes without fallbacks)"fixes #123"
present in the PR description)