mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-21 03:37:08 +00:00
* [asciidoc] add form params and authorization headers (#4467) * [asciidoc] differentiate between basic and bearer auth
This commit is contained in:
@@ -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}}
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user