Enhancements to documentation generators (samples, default values, etc) (#790)

* enhancements to doc generators (samples, default values, etc)

* add 3.3.x to PR template
This commit is contained in:
William Cheng 2018-08-13 13:27:45 +08:00 committed by GitHub
parent 5e1c4cde50
commit c237fe9f1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
59 changed files with 27 additions and 27 deletions

View File

@ -2,7 +2,7 @@
- [ ] Read the [contribution guidelines](https://github.com/openapitools/openapi-generator/blob/master/CONTRIBUTING.md).
- [ ] 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` and `./bin/security/{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](https://github.com/OpenAPITools/openapi-generator/wiki/Git-Branches): `master`, `4.0.x`. Default: `master`.
- [ ] Filed the PR against the [correct branch](https://github.com/OpenAPITools/openapi-generator/wiki/Git-Branches): `master`, `3.3.x`, `4.0.x`. Default: `master`.
- [ ] Copied the [technical committee](https://github.com/openapitools/openapi-generator/#62---openapi-generator-technical-committee) to review the pull request if your PR is targeting a particular programming language.
### Description of the PR

View File

@ -27,6 +27,6 @@ fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dynamic-html -o samples/dynamic-html $@"
ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dynamic-html -o samples/documentation/dynamic-html $@"
java $JAVA_OPTS -jar $executable $ags

View File

@ -27,6 +27,6 @@ fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -i modules/openapi-generator/src/test/resources/2_0/markdown.yaml -g html -o samples/html.md $@"
ags="generate -i modules/openapi-generator/src/test/resources/2_0/markdown.yaml -g html -o samples/documentation/html.md $@"
java $JAVA_OPTS -jar $executable $ags

View File

@ -27,6 +27,6 @@ fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g html -o samples/html $@"
ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g html -o samples/documentation/html $@"
java $JAVA_OPTS -jar $executable $ags

View File

@ -27,6 +27,6 @@ fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g html2 -o samples/html2 --additional-properties hideGenerationTimestamp=true $@"
ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g html2 -o samples/documentation/html2 --additional-properties hideGenerationTimestamp=true $@"
java $JAVA_OPTS -jar $executable $ags

View File

@ -5,6 +5,6 @@ If Not Exist %executable% (
)
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties
set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g html -o samples\client\petstore\html
set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g html -o samples\documentation\html
java %JAVA_OPTS% -jar %executable% %ags%

View File

@ -5,6 +5,6 @@ If Not Exist %executable% (
)
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties
set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g html2 -o samples\html2
set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g html2 -o samples\documentation\html2
java %JAVA_OPTS% -jar %executable% %ags%

View File

@ -60,9 +60,9 @@ public class ConfluenceWikiCodegen extends DefaultCodegen implements CodegenConf
cliOptions.add(new CliOption(CodegenConstants.ARTIFACT_VERSION, CodegenConstants.ARTIFACT_VERSION_DESC));
additionalProperties.put("appName", "OpenAPI Sample");
additionalProperties.put("appDescription", "A sample openapi server");
additionalProperties.put("infoUrl", "https://helloreverb.com");
additionalProperties.put("infoEmail", "hello@helloreverb.com");
additionalProperties.put("appDescription", "A sample OpenAPI server");
additionalProperties.put("infoUrl", "https://openapi-generator.tech");
additionalProperties.put("infoEmail", "team@openapitools.org");
additionalProperties.put("licenseInfo", "All rights reserved");
additionalProperties.put("licenseUrl", "http://apache.org/licenses/LICENSE-2.0.html");
additionalProperties.put(CodegenConstants.INVOKER_PACKAGE, invokerPackage);

View File

@ -43,7 +43,7 @@ public class StaticDocCodegen extends DefaultCodegen implements CodegenConfig {
outputFolder = "docs";
modelTemplateFiles.put("model.mustache", ".html");
apiTemplateFiles.put("operation.mustache", ".html");
embeddedTemplateDir = templateDir = "swagger-static";
embeddedTemplateDir = templateDir = "openapi-static";
cliOptions.add(new CliOption(CodegenConstants.INVOKER_PACKAGE, CodegenConstants.INVOKER_PACKAGE_DESC));
cliOptions.add(new CliOption(CodegenConstants.GROUP_ID, CodegenConstants.GROUP_ID_DESC));
@ -94,8 +94,8 @@ public class StaticDocCodegen extends DefaultCodegen implements CodegenConfig {
}
@Override
public String escapeReservedWord(String name) {
if(this.reservedWordsMappings().containsKey(name)) {
public String escapeReservedWord(String name) {
if (this.reservedWordsMappings().containsKey(name)) {
return this.reservedWordsMappings().get(name);
}
return "_" + name;
@ -121,5 +121,5 @@ public class StaticDocCodegen extends DefaultCodegen implements CodegenConfig {
public String escapeUnsafeCharacters(String input) {
// just return the original string
return input;
}
}
}

View File

@ -82,9 +82,9 @@ public class StaticHtml2Generator extends DefaultCodegen implements CodegenConfi
cliOptions.add(new CliOption(CodegenConstants.ARTIFACT_VERSION, CodegenConstants.ARTIFACT_VERSION_DESC));
additionalProperties.put("appName", "OpenAPI Sample");
additionalProperties.put("appDescription", "A sample openapi server");
additionalProperties.put("appDescription", "A sample OpenAPI server");
additionalProperties.put("infoUrl", "https://openapi-generator.tech");
additionalProperties.put("infoEmail", "contributors@openapitools.org");
additionalProperties.put("infoEmail", "team@openapitools.org");
additionalProperties.put("licenseInfo", "All rights reserved");
additionalProperties.put("licenseUrl", "http://apache.org/licenses/LICENSE-2.0.html");
additionalProperties.put(CodegenConstants.INVOKER_PACKAGE, invokerPackage);
@ -180,7 +180,7 @@ public class StaticHtml2Generator extends DefaultCodegen implements CodegenConfi
Map<String, Object> vendorExtensions = openAPI.getExtensions();
if (vendorExtensions != null) {
for(Map.Entry<String, Object> vendorExtension: vendorExtensions.entrySet()) {
for (Map.Entry<String, Object> vendorExtension : vendorExtensions.entrySet()) {
// Vendor extensions could be Maps (objects). If we wanted to iterate through them in our template files
// without knowing the keys beforehand, the default `toString` method renders them unusable. Instead, we
// convert them to JSON strings now, which means we can easily use them later.

View File

@ -69,9 +69,9 @@ public class StaticHtmlGenerator extends DefaultCodegen implements CodegenConfig
cliOptions.add(new CliOption(CodegenConstants.ARTIFACT_VERSION, CodegenConstants.ARTIFACT_VERSION_DESC));
additionalProperties.put("appName", "OpenAPI Sample");
additionalProperties.put("appDescription", "A sample openapi server");
additionalProperties.put("infoUrl", "https://helloreverb.com");
additionalProperties.put("infoEmail", "hello@helloreverb.com");
additionalProperties.put("appDescription", "A sample OpenAPI server");
additionalProperties.put("infoUrl", "https//openapi-generator.tech");
additionalProperties.put("infoEmail", "team@openapitools.org");
additionalProperties.put("licenseInfo", "All rights reserved");
additionalProperties.put("licenseUrl", "http://apache.org/licenses/LICENSE-2.0.html");
additionalProperties.put(CodegenConstants.INVOKER_PACKAGE, invokerPackage);

View File

@ -1 +1 @@
3.0.0-SNAPSHOT
3.2.1-SNAPSHOT

View File

@ -0,0 +1 @@
3.2.1-SNAPSHOT

View File

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

View File

@ -0,0 +1 @@
3.2.1-SNAPSHOT

View File

@ -181,8 +181,8 @@ font-style: italic;
<body>
<h1>OpenAPI Petstore</h1>
<div class="app-desc">This is a sample server Petstore server. For this sample, you can use the api key <code>special-key</code> to test the authorization filters.</div>
<div class="app-desc">More information: <a href="https://helloreverb.com">https://helloreverb.com</a></div>
<div class="app-desc">Contact Info: <a href="hello@helloreverb.com">hello@helloreverb.com</a></div>
<div class="app-desc">More information: <a href="https//openapi-generator.tech">https//openapi-generator.tech</a></div>
<div class="app-desc">Contact Info: <a href="team@openapitools.org">team@openapitools.org</a></div>
<div class="app-desc">Version: 1.0.0</div>
<div class="app-desc">BasePath:/v2</div>
<div class="license-info">Apache-2.0</div>

View File

@ -0,0 +1 @@
3.2.1-SNAPSHOT

View File

@ -8103,7 +8103,7 @@ $(document).ready(function() {
<div id="api-_footer">
<p>Suggestions, contact, support and error reporting;
<div class="app-desc">Information URL: <a href="https://openapi-generator.tech">https://openapi-generator.tech</a></div>
<div class="app-desc">Contact Info: <a href="contributors@openapitools.org">contributors@openapitools.org</a></div>
<div class="app-desc">Contact Info: <a href="team@openapitools.org">team@openapitools.org</a></div>
</p>
<div class="license-info">Apache-2.0</div>
<div class="license-url">http://www.apache.org/licenses/LICENSE-2.0.html</div>

View File

@ -1 +0,0 @@
3.0.0-SNAPSHOT

View File

@ -1 +0,0 @@
3.0.0-SNAPSHOT

View File

@ -1 +0,0 @@
3.1.2-SNAPSHOT