forked from loafle/openapi-generator-original
* [asciidoc] add form params and authorization headers (#4467) * [asciidoc] differentiate between basic and bearer auth
This commit is contained in:
parent
db77e070d1
commit
3adfdfafea
@ -8,7 +8,7 @@
|
|||||||
:keywords: openapi, rest, {{appName}}
|
:keywords: openapi, rest, {{appName}}
|
||||||
:specDir: {{specDir}}
|
:specDir: {{specDir}}
|
||||||
:snippetDir: {{snippetDir}}
|
:snippetDir: {{snippetDir}}
|
||||||
:generator-template: v1 2019-11-10
|
:generator-template: v1 2019-11-19
|
||||||
:info-url: {{infoUrl}}
|
:info-url: {{infoUrl}}
|
||||||
:app-name: {{appName}}
|
:app-name: {{appName}}
|
||||||
|
|
||||||
@ -18,6 +18,20 @@
|
|||||||
|
|
||||||
{{#specinclude}}intro.adoc{{/specinclude}}
|
{{#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
|
== Endpoints
|
||||||
|
|
||||||
{{#apiInfo}}
|
{{#apiInfo}}
|
||||||
|
@ -26,6 +26,19 @@
|
|||||||
|===
|
|===
|
||||||
{{/hasBodyParam}}
|
{{/hasBodyParam}}
|
||||||
|
|
||||||
|
{{#hasFormParams}}
|
||||||
|
===== Form Parameter
|
||||||
|
|
||||||
|
[cols="2,3,1,1,1"]
|
||||||
|
|===
|
||||||
|
|Name| Description| Required| Default| Pattern
|
||||||
|
|
||||||
|
{{#formParams}}
|
||||||
|
{{>param}}
|
||||||
|
{{/formParams}}
|
||||||
|
|===
|
||||||
|
{{/hasFormParams}}
|
||||||
|
|
||||||
{{#hasHeaderParams}}
|
{{#hasHeaderParams}}
|
||||||
====== Header Parameters
|
====== Header Parameters
|
||||||
|
|
||||||
|
@ -115,4 +115,26 @@ public class AsciidocSampleGeneratorTest {
|
|||||||
"keep parameter name from-iso-date-string unchanged.");
|
"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.");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1 +1 @@
|
|||||||
4.2.1-SNAPSHOT
|
4.2.2-SNAPSHOT
|
@ -8,7 +8,7 @@ team@openapitools.org
|
|||||||
:keywords: openapi, rest, OpenAPI Petstore
|
:keywords: openapi, rest, OpenAPI Petstore
|
||||||
:specDir: modules\openapi-generator\src\main\resources\asciidoc-documentation
|
:specDir: modules\openapi-generator\src\main\resources\asciidoc-documentation
|
||||||
:snippetDir: .
|
:snippetDir: .
|
||||||
:generator-template: v1 2019-11-10
|
:generator-template: v1 2019-11-19
|
||||||
:info-url: https://openapi-generator.tech
|
:info-url: https://openapi-generator.tech
|
||||||
:app-name: OpenAPI Petstore
|
: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]
|
// 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
|
== Endpoints
|
||||||
|
|
||||||
|
|
||||||
@ -63,6 +71,7 @@ Add a new pet to the store
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
===== Return Type
|
===== Return Type
|
||||||
|
|
||||||
|
|
||||||
@ -139,6 +148,7 @@ Deletes a pet
|
|||||||
|===
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
====== Header Parameters
|
====== Header Parameters
|
||||||
|
|
||||||
[cols="2,3,1,1,1"]
|
[cols="2,3,1,1,1"]
|
||||||
@ -219,6 +229,7 @@ Multiple status values can be provided with comma separated strings
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
====== Query Parameters
|
====== Query Parameters
|
||||||
|
|
||||||
[cols="2,3,1,1,1"]
|
[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
|
====== Query Parameters
|
||||||
|
|
||||||
[cols="2,3,1,1,1"]
|
[cols="2,3,1,1,1"]
|
||||||
@ -408,6 +420,7 @@ Returns a single pet
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
===== Return Type
|
===== Return Type
|
||||||
|
|
||||||
<<Pet>>
|
<<Pet>>
|
||||||
@ -500,6 +513,7 @@ Update an existing pet
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
===== Return Type
|
===== 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 <<string>>
|
||||||
|
| -
|
||||||
|
| null
|
||||||
|
|
|
||||||
|
|
||||||
|
| status
|
||||||
|
| Updated status of the pet <<string>>
|
||||||
|
| -
|
||||||
|
| 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 <<string>>
|
||||||
|
| -
|
||||||
|
| null
|
||||||
|
|
|
||||||
|
|
||||||
|
| file
|
||||||
|
| file to upload <<file>>
|
||||||
|
| -
|
||||||
|
| null
|
||||||
|
|
|
||||||
|
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -753,6 +807,7 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or non
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
===== Return Type
|
===== Return Type
|
||||||
|
|
||||||
|
|
||||||
@ -824,6 +879,7 @@ Returns a map of status codes to quantities
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
===== Return Type
|
===== Return Type
|
||||||
|
|
||||||
|
|
||||||
@ -906,6 +962,7 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
===== Return Type
|
===== Return Type
|
||||||
|
|
||||||
<<Order>>
|
<<Order>>
|
||||||
@ -998,6 +1055,7 @@ Place an order for a pet
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
===== Return Type
|
===== Return Type
|
||||||
|
|
||||||
<<Order>>
|
<<Order>>
|
||||||
@ -1089,6 +1147,7 @@ This can only be done by the logged in user.
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
===== Return Type
|
===== Return Type
|
||||||
|
|
||||||
|
|
||||||
@ -1168,6 +1227,7 @@ Creates list of users with given input array
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
===== Return Type
|
===== Return Type
|
||||||
|
|
||||||
|
|
||||||
@ -1247,6 +1307,7 @@ Creates list of users with given input array
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
===== Return Type
|
===== Return Type
|
||||||
|
|
||||||
|
|
||||||
@ -1326,6 +1387,7 @@ This can only be done by the logged in user.
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
===== Return Type
|
===== Return Type
|
||||||
|
|
||||||
|
|
||||||
@ -1410,6 +1472,7 @@ Get user by user name
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
===== Return Type
|
===== Return Type
|
||||||
|
|
||||||
<<User>>
|
<<User>>
|
||||||
@ -1487,6 +1550,7 @@ Logs user into the system
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
====== Query Parameters
|
====== Query Parameters
|
||||||
|
|
||||||
[cols="2,3,1,1,1"]
|
[cols="2,3,1,1,1"]
|
||||||
@ -1583,6 +1647,7 @@ Logs out current logged in user session
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
===== Return Type
|
===== Return Type
|
||||||
|
|
||||||
|
|
||||||
@ -1675,6 +1740,7 @@ This can only be done by the logged in user.
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
===== Return Type
|
===== Return Type
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user