From 09d389562c5694a872864c64f3e35ac7ae1ac56b Mon Sep 17 00:00:00 2001 From: Kraust Date: Fri, 3 Sep 2021 12:28:05 -0400 Subject: [PATCH 1/2] Updated the HTML2 Doc Curl Examples to provide sample Request Body & Query Param examples. --- .../src/main/resources/htmlDocs2/index.mustache | 6 +----- .../src/main/resources/htmlDocs2/sample_curl.mustache | 6 ++++++ 2 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 modules/openapi-generator/src/main/resources/htmlDocs2/sample_curl.mustache diff --git a/modules/openapi-generator/src/main/resources/htmlDocs2/index.mustache b/modules/openapi-generator/src/main/resources/htmlDocs2/index.mustache index 10af1ef7d195..ff06be66f3e8 100644 --- a/modules/openapi-generator/src/main/resources/htmlDocs2/index.mustache +++ b/modules/openapi-generator/src/main/resources/htmlDocs2/index.mustache @@ -248,11 +248,7 @@
-
curl -X {{vendorExtensions.x-codegen-http-method-upper-case}}{{#authMethods}}\
-{{#isApiKey}}{{#isKeyInHeader}}-H "{{keyParamName}}: [[apiKey]]"{{/isKeyInHeader}}{{/isApiKey}}{{^isBasicBearer}}{{#isBasic}} -H "Authorization: Basic [[basicHash]]"{{/isBasic}}{{/isBasicBearer}}{{#isBasicBearer}} -H "Authorization: Bearer [[accessToken]]"{{/isBasicBearer}}{{/authMethods}}{{#hasProduces}}\
- -H "Accept: {{#produces}}{{{mediaType}}}{{^-last}},{{/-last}}{{/produces}}"{{/hasProduces}}{{#hasConsumes}}\
- -H "Content-Type: {{#consumes}}{{{mediaType}}}{{^-last}},{{/-last}}{{/consumes}}"{{/hasConsumes}}\
- "{{basePath}}{{path}}{{#hasQueryParams}}?{{#queryParams}}{{^-first}}&{{/-first}}{{baseName}}={{vendorExtensions.x-eg}}{{/queryParams}}{{/hasQueryParams}}"
+
{{>sample_curl}}
{{>sample_java}}
diff --git a/modules/openapi-generator/src/main/resources/htmlDocs2/sample_curl.mustache b/modules/openapi-generator/src/main/resources/htmlDocs2/sample_curl.mustache new file mode 100644 index 000000000000..616db8488418 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/htmlDocs2/sample_curl.mustache @@ -0,0 +1,6 @@ +curl -X {{vendorExtensions.x-codegen-http-method-upper-case}}{{#authMethods}} \ +{{#isApiKey}}{{#isKeyInHeader}}-H "{{keyParamName}}: [[apiKey]]"{{/isKeyInHeader}}{{/isApiKey}}{{^isBasicBearer}}{{#isBasic}} -H "Authorization: Basic [[basicHash]]"{{/isBasic}}{{/isBasicBearer}}{{#isBasicBearer}} -H "Authorization: Bearer [[accessToken]]"{{/isBasicBearer}}{{/authMethods}}{{#hasProduces}} \ + -H "Accept: {{#produces}}{{{mediaType}}}{{^-last}},{{/-last}}{{/produces}}"{{/hasProduces}}{{#hasConsumes}} \ + -H "Content-Type: {{#consumes}}{{{mediaType}}}{{^-last}},{{/-last}}{{/consumes}}"{{/hasConsumes}} \ + "{{basePath}}{{path}}{{#hasQueryParams}}?{{#queryParams}}{{^-first}}&{{/-first}}{{baseName}}={{{example}}}{{/queryParams}}{{/hasQueryParams}}"{{#requestBodyExamples}} \ + -d '{{example}}'{{/requestBodyExamples}} From 8ca448df99c36928fe2abf426ebc243880cb5d3b Mon Sep 17 00:00:00 2001 From: Kraust Date: Fri, 3 Sep 2021 12:28:05 -0400 Subject: [PATCH 2/2] Updated the HTML2 Doc Curl Examples to provide sample Request Body & Query Param examples. --- .../src/main/resources/htmlDocs2/index.mustache | 6 +----- .../src/main/resources/htmlDocs2/sample_curl.mustache | 6 ++++++ 2 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 modules/openapi-generator/src/main/resources/htmlDocs2/sample_curl.mustache diff --git a/modules/openapi-generator/src/main/resources/htmlDocs2/index.mustache b/modules/openapi-generator/src/main/resources/htmlDocs2/index.mustache index 10af1ef7d195..ff06be66f3e8 100644 --- a/modules/openapi-generator/src/main/resources/htmlDocs2/index.mustache +++ b/modules/openapi-generator/src/main/resources/htmlDocs2/index.mustache @@ -248,11 +248,7 @@
-
curl -X {{vendorExtensions.x-codegen-http-method-upper-case}}{{#authMethods}}\
-{{#isApiKey}}{{#isKeyInHeader}}-H "{{keyParamName}}: [[apiKey]]"{{/isKeyInHeader}}{{/isApiKey}}{{^isBasicBearer}}{{#isBasic}} -H "Authorization: Basic [[basicHash]]"{{/isBasic}}{{/isBasicBearer}}{{#isBasicBearer}} -H "Authorization: Bearer [[accessToken]]"{{/isBasicBearer}}{{/authMethods}}{{#hasProduces}}\
- -H "Accept: {{#produces}}{{{mediaType}}}{{^-last}},{{/-last}}{{/produces}}"{{/hasProduces}}{{#hasConsumes}}\
- -H "Content-Type: {{#consumes}}{{{mediaType}}}{{^-last}},{{/-last}}{{/consumes}}"{{/hasConsumes}}\
- "{{basePath}}{{path}}{{#hasQueryParams}}?{{#queryParams}}{{^-first}}&{{/-first}}{{baseName}}={{vendorExtensions.x-eg}}{{/queryParams}}{{/hasQueryParams}}"
+
{{>sample_curl}}
{{>sample_java}}
diff --git a/modules/openapi-generator/src/main/resources/htmlDocs2/sample_curl.mustache b/modules/openapi-generator/src/main/resources/htmlDocs2/sample_curl.mustache new file mode 100644 index 000000000000..616db8488418 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/htmlDocs2/sample_curl.mustache @@ -0,0 +1,6 @@ +curl -X {{vendorExtensions.x-codegen-http-method-upper-case}}{{#authMethods}} \ +{{#isApiKey}}{{#isKeyInHeader}}-H "{{keyParamName}}: [[apiKey]]"{{/isKeyInHeader}}{{/isApiKey}}{{^isBasicBearer}}{{#isBasic}} -H "Authorization: Basic [[basicHash]]"{{/isBasic}}{{/isBasicBearer}}{{#isBasicBearer}} -H "Authorization: Bearer [[accessToken]]"{{/isBasicBearer}}{{/authMethods}}{{#hasProduces}} \ + -H "Accept: {{#produces}}{{{mediaType}}}{{^-last}},{{/-last}}{{/produces}}"{{/hasProduces}}{{#hasConsumes}} \ + -H "Content-Type: {{#consumes}}{{{mediaType}}}{{^-last}},{{/-last}}{{/consumes}}"{{/hasConsumes}} \ + "{{basePath}}{{path}}{{#hasQueryParams}}?{{#queryParams}}{{^-first}}&{{/-first}}{{baseName}}={{{example}}}{{/queryParams}}{{/hasQueryParams}}"{{#requestBodyExamples}} \ + -d '{{example}}'{{/requestBodyExamples}}