diff --git a/modules/openapi-generator/src/main/resources/asciidoc-documentation/index.mustache b/modules/openapi-generator/src/main/resources/asciidoc-documentation/index.mustache index 99cd8d8f664..f3783348c04 100644 --- a/modules/openapi-generator/src/main/resources/asciidoc-documentation/index.mustache +++ b/modules/openapi-generator/src/main/resources/asciidoc-documentation/index.mustache @@ -8,7 +8,7 @@ :keywords: openapi, rest, {{appName}} :specDir: {{specDir}} :snippetDir: {{snippetDir}} -:generator-template: v1 2019-11-10 +:generator-template: v1 2019-11-19 :info-url: {{infoUrl}} :app-name: {{appName}} @@ -18,6 +18,20 @@ {{#specinclude}}intro.adoc{{/specinclude}} +{{#hasAuthMethods}} +== Access + +{{#authMethods}} +{{#isBasic}} +{{^isBasicBearer}}* *HTTP Basic* Authentication _{{{name}}}_{{/isBasicBearer}} +{{#isBasicBearer}}* *Bearer* Authentication {{/isBasicBearer}} +{{/isBasic}} +{{#isOAuth}}* *OAuth* AuthorizationUrl: _{{authorizationUrl}}_, TokenUrl: _{{tokenUrl}}_ {{/isOAuth}} +{{#isApiKey}}* *APIKey* KeyParamName: _{{keyParamName}}_, KeyInQuery: _{{isKeyInQuery}}_, KeyInHeader: _{{isKeyInHeader}}_{{/isApiKey}} +{{/authMethods}} + +{{/hasAuthMethods}} + == Endpoints {{#apiInfo}} diff --git a/modules/openapi-generator/src/main/resources/asciidoc-documentation/params.mustache b/modules/openapi-generator/src/main/resources/asciidoc-documentation/params.mustache index 9be5b8377f0..029f10fb5a5 100644 --- a/modules/openapi-generator/src/main/resources/asciidoc-documentation/params.mustache +++ b/modules/openapi-generator/src/main/resources/asciidoc-documentation/params.mustache @@ -26,6 +26,19 @@ |=== {{/hasBodyParam}} +{{#hasFormParams}} +===== Form Parameter + +[cols="2,3,1,1,1"] +|=== +|Name| Description| Required| Default| Pattern + +{{#formParams}} +{{>param}} +{{/formParams}} +|=== +{{/hasFormParams}} + {{#hasHeaderParams}} ====== Header Parameters diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/asciidoc/AsciidocSampleGeneratorTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/asciidoc/AsciidocSampleGeneratorTest.java index d12d2b6f75a..f903d74d79c 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/asciidoc/AsciidocSampleGeneratorTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/asciidoc/AsciidocSampleGeneratorTest.java @@ -115,4 +115,26 @@ public class AsciidocSampleGeneratorTest { "keep parameter name from-iso-date-string unchanged."); } + /** + * added apikey info in access section. + */ + @Test + public void testSampleAsciidocMarkupGenerationAccessApiKey() throws Exception { + Assert.assertTrue(markupContent.contains("*APIKey*"), + "access section mit apikey expected."); + Assert.assertFalse(markupContent.contains("*OAuth*"), + "access section no oauth expected."); + Assert.assertFalse(markupContent.contains("*HTTP Basic*"), + "access section no http basic expected."); + } + + /** + * no form params in this sample spec. + */ + @Test + public void testSampleAsciidocMarkupGenerationWithoutFormParameter() throws Exception { + Assert.assertFalse(markupContent.contains("= Form Parameter"), + "no form parameters in this openapi spec expected."); + } + } diff --git a/samples/documentation/asciidoc/.openapi-generator/VERSION b/samples/documentation/asciidoc/.openapi-generator/VERSION index d168f1d8bda..e4955748d3e 100644 --- a/samples/documentation/asciidoc/.openapi-generator/VERSION +++ b/samples/documentation/asciidoc/.openapi-generator/VERSION @@ -1 +1 @@ -4.2.1-SNAPSHOT \ No newline at end of file +4.2.2-SNAPSHOT \ No newline at end of file diff --git a/samples/documentation/asciidoc/index.adoc b/samples/documentation/asciidoc/index.adoc index 5e174f0842f..295ff335844 100644 --- a/samples/documentation/asciidoc/index.adoc +++ b/samples/documentation/asciidoc/index.adoc @@ -8,7 +8,7 @@ team@openapitools.org :keywords: openapi, rest, OpenAPI Petstore :specDir: modules\openapi-generator\src\main\resources\asciidoc-documentation :snippetDir: . -:generator-template: v1 2019-11-10 +:generator-template: v1 2019-11-19 :info-url: https://openapi-generator.tech :app-name: OpenAPI Petstore @@ -20,6 +20,14 @@ This is a sample server Petstore server. For this sample, you can use the api ke // markup not found, no include ::intro.adoc[opts=optional] +== Access + + +* *APIKey* KeyParamName: _api_key_, KeyInQuery: _false_, KeyInHeader: _true_ +* *OAuth* AuthorizationUrl: _http://petstore.swagger.io/api/oauth/dialog_, TokenUrl: __ + + + == Endpoints @@ -63,6 +71,7 @@ Add a new pet to the store + ===== Return Type @@ -139,6 +148,7 @@ Deletes a pet |=== + ====== Header Parameters [cols="2,3,1,1,1"] @@ -219,6 +229,7 @@ Multiple status values can be provided with comma separated strings + ====== Query Parameters [cols="2,3,1,1,1"] @@ -306,6 +317,7 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 + ====== Query Parameters [cols="2,3,1,1,1"] @@ -408,6 +420,7 @@ Returns a single pet + ===== Return Type <> @@ -500,6 +513,7 @@ Update an existing pet + ===== Return Type @@ -586,6 +600,26 @@ Updates a pet in the store with form data |=== +===== Form Parameter + +[cols="2,3,1,1,1"] +|=== +|Name| Description| Required| Default| Pattern + +| name +| Updated name of the pet <> +| - +| null +| + +| status +| Updated status of the pet <> +| - +| null +| + +|=== + @@ -665,6 +699,26 @@ uploads an image |=== +===== Form Parameter + +[cols="2,3,1,1,1"] +|=== +|Name| Description| Required| Default| Pattern + +| additionalMetadata +| Additional data to pass to server <> +| - +| null +| + +| file +| file to upload <> +| - +| null +| + +|=== + @@ -753,6 +807,7 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or non + ===== Return Type @@ -824,6 +879,7 @@ Returns a map of status codes to quantities + ===== Return Type @@ -906,6 +962,7 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge + ===== Return Type <> @@ -998,6 +1055,7 @@ Place an order for a pet + ===== Return Type <> @@ -1089,6 +1147,7 @@ This can only be done by the logged in user. + ===== Return Type @@ -1168,6 +1227,7 @@ Creates list of users with given input array + ===== Return Type @@ -1247,6 +1307,7 @@ Creates list of users with given input array + ===== Return Type @@ -1326,6 +1387,7 @@ This can only be done by the logged in user. + ===== Return Type @@ -1410,6 +1472,7 @@ Get user by user name + ===== Return Type <> @@ -1487,6 +1550,7 @@ Logs user into the system + ====== Query Parameters [cols="2,3,1,1,1"] @@ -1583,6 +1647,7 @@ Logs out current logged in user session + ===== Return Type @@ -1675,6 +1740,7 @@ This can only be done by the logged in user. + ===== Return Type