diff --git a/bin/go-experimental-petstore.sh b/bin/go-experimental-petstore.sh
new file mode 100755
index 000000000000..d4eabb177cc9
--- /dev/null
+++ b/bin/go-experimental-petstore.sh
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+SCRIPT="$0"
+echo "# START SCRIPT: $SCRIPT"
+
+while [ -h "$SCRIPT" ] ; do
+ ls=`ls -ld "$SCRIPT"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ SCRIPT="$link"
+ else
+ SCRIPT=`dirname "$SCRIPT"`/"$link"
+ fi
+done
+
+if [ ! -d "${APP_DIR}" ]; then
+ APP_DIR=`dirname "$SCRIPT"`/..
+ APP_DIR=`cd "${APP_DIR}"; pwd`
+fi
+
+executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
+
+if [ ! -f "$executable" ]
+then
+ mvn -B clean package
+fi
+
+SPEC="modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml"
+GENERATOR="go-experimental"
+STUB_DIR="samples/client/petstore/go-experimental/go-petstore"
+
+echo "Removing files and folders under $STUB_DIR"
+rm -rf $STUB_DIR
+
+# if you've executed sbt assembly previously it will use that instead.
+export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
+ags="generate -t modules/openapi-generator/src/main/resources/$GENERATOR -i $SPEC -g $GENERATOR -o $STUB_DIR -DpackageName=petstore $@"
+
+java $JAVA_OPTS -jar $executable $ags
diff --git a/bin/openapi3/go-experimental-petstore.sh b/bin/openapi3/go-experimental-petstore.sh
new file mode 100755
index 000000000000..db24ff5d6c8c
--- /dev/null
+++ b/bin/openapi3/go-experimental-petstore.sh
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+SCRIPT="$0"
+echo "# START SCRIPT: $SCRIPT"
+
+while [ -h "$SCRIPT" ] ; do
+ ls=`ls -ld "$SCRIPT"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ SCRIPT="$link"
+ else
+ SCRIPT=`dirname "$SCRIPT"`/"$link"
+ fi
+done
+
+if [ ! -d "${APP_DIR}" ]; then
+ APP_DIR=`dirname "$SCRIPT"`/..
+ APP_DIR=`cd "${APP_DIR}"; pwd`
+fi
+
+executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
+
+if [ ! -f "$executable" ]
+then
+ mvn -B clean package
+fi
+
+SPEC="modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml"
+GENERATOR="go-experimental"
+STUB_DIR="samples/openapi3/client/petstore/go-experimental/go-petstore"
+
+echo "Removing files and folders under $STUB_DIR"
+rm -rf $STUB_DIR
+
+# if you've executed sbt assembly previously it will use that instead.
+export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
+ags="generate -t modules/openapi-generator/src/main/resources/$GENERATOR -i $SPEC -g $GENERATOR -o $STUB_DIR -DpackageName=petstore $@"
+
+java $JAVA_OPTS -jar $executable $ags
diff --git a/bin/windows/go-experimental-petstore.bat b/bin/windows/go-experimental-petstore.bat
new file mode 100755
index 000000000000..1a62e273e5d4
--- /dev/null
+++ b/bin/windows/go-experimental-petstore.bat
@@ -0,0 +1,21 @@
+setlocal
+
+set executable=.\modules\openapi-generator-cli\target\openapi-generator-cli.jar
+
+If Not Exist %executable% (
+ mvn clean package
+)
+
+set SPEC=modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml
+set GENERATOR=go-experimental
+set STUB_DIR=samples\client\petstore\go-experimental\go-petstore
+
+echo Removing files and folders under %STUB_DIR%
+del /F /S /Q %STUB_DIR%
+
+REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties
+set ags=generate -t modules\openapi-generator\src\main\resources\%GENERATOR% -i %SPEC% -g %GENERATOR% -o %STUB_DIR% -DpackageName=petstore
+
+java %JAVA_OPTS% -jar %executable% %ags%
+
+endlocal
diff --git a/docs/generators.md b/docs/generators.md
index 5f890cab5bcc..9736648c7e53 100644
--- a/docs/generators.md
+++ b/docs/generators.md
@@ -27,6 +27,7 @@ The following generators are available:
- [erlang-proper](generators/erlang-proper.md)
- [flash](generators/flash.md)
- [go](generators/go.md)
+ - [go-experimental](generators/go-experimental.md)
- [groovy](generators/groovy.md)
- [haskell-http-client](generators/haskell-http-client.md)
- [java](generators/java.md)
diff --git a/docs/generators/go-experimental.md b/docs/generators/go-experimental.md
new file mode 100644
index 000000000000..23670cfd7b0a
--- /dev/null
+++ b/docs/generators/go-experimental.md
@@ -0,0 +1,16 @@
+
+---
+id: generator-opts-client-go-experimental
+title: Config Options for go-experimental
+sidebar_label: go-experimental
+---
+
+| Option | Description | Values | Default |
+| ------ | ----------- | ------ | ------- |
+|packageName|Go package name (convention: lowercase).| |openapi|
+|packageVersion|Go package version.| |1.0.0|
+|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
+|isGoSubmodule|whether the generated Go module is a submodule| |false|
+|withGoCodegenComment|whether to include Go codegen comment to disable Go Lint and collapse by default GitHub in PRs and diffs| |false|
+|withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false|
+|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientExperimentalCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientExperimentalCodegen.java
new file mode 100644
index 000000000000..14148714e64f
--- /dev/null
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientExperimentalCodegen.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.openapitools.codegen.languages;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class GoClientExperimentalCodegen extends GoClientCodegen {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(GoClientExperimentalCodegen.class);
+
+ public GoClientExperimentalCodegen() {
+ super();
+ }
+
+ /**
+ * Configures a friendly name for the generator. This will be used by the generator
+ * to select the library with the -g flag.
+ *
+ * @return the friendly name for the generator
+ */
+ @Override
+ public String getName() {
+ return "go-experimental";
+ }
+
+ /**
+ * Returns human-friendly help for the generator. Provide the consumer with help
+ * tips, parameters here
+ *
+ * @return A string value for the help message
+ */
+ @Override
+ public String getHelp() {
+ return "Generates a Go client library (experimental and may subject to breaking changes without further notice).";
+ }
+
+}
diff --git a/modules/openapi-generator/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig b/modules/openapi-generator/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig
index 3f21ea57ec09..efbcccf2495f 100644
--- a/modules/openapi-generator/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig
+++ b/modules/openapi-generator/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig
@@ -28,6 +28,7 @@ org.openapitools.codegen.languages.ErlangProperCodegen
org.openapitools.codegen.languages.ErlangServerCodegen
org.openapitools.codegen.languages.FlashClientCodegen
org.openapitools.codegen.languages.GoClientCodegen
+org.openapitools.codegen.languages.GoClientExperimentalCodegen
org.openapitools.codegen.languages.GoServerCodegen
org.openapitools.codegen.languages.GoGinServerCodegen
org.openapitools.codegen.languages.GraphQLSchemaCodegen
diff --git a/modules/openapi-generator/src/main/resources/go-experimental/.travis.yml b/modules/openapi-generator/src/main/resources/go-experimental/.travis.yml
new file mode 100644
index 000000000000..f5cb2ce9a5aa
--- /dev/null
+++ b/modules/openapi-generator/src/main/resources/go-experimental/.travis.yml
@@ -0,0 +1,8 @@
+language: go
+
+install:
+ - go get -d -v .
+
+script:
+ - go build -v ./
+
diff --git a/modules/openapi-generator/src/main/resources/go-experimental/README.mustache b/modules/openapi-generator/src/main/resources/go-experimental/README.mustache
new file mode 100644
index 000000000000..5c9639022a17
--- /dev/null
+++ b/modules/openapi-generator/src/main/resources/go-experimental/README.mustache
@@ -0,0 +1,119 @@
+# Go API client for {{packageName}}
+
+{{#appDescription}}
+{{{appDescription}}}
+{{/appDescription}}
+
+## Overview
+This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client.
+
+- API version: {{appVersion}}
+- Package version: {{packageVersion}}
+{{^hideGenerationTimestamp}}
+- Build date: {{generatedDate}}
+{{/hideGenerationTimestamp}}
+- Build package: {{generatorClass}}
+{{#infoUrl}}
+For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
+{{/infoUrl}}
+
+## Installation
+
+Install the following dependencies:
+
+```shell
+go get github.com/stretchr/testify/assert
+go get golang.org/x/oauth2
+go get golang.org/x/net/context
+go get github.com/antihax/optional
+```
+
+Put the package under your project folder and add the following in import:
+
+```golang
+import "./{{packageName}}"
+```
+
+## Documentation for API Endpoints
+
+All URIs are relative to *{{basePath}}*
+
+Class | Method | HTTP request | Description
+------------ | ------------- | ------------- | -------------
+{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}}
+{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
+
+## Documentation For Models
+
+{{#models}}{{#model}} - [{{{classname}}}]({{modelDocPath}}{{{classname}}}.md)
+{{/model}}{{/models}}
+
+## Documentation For Authorization
+
+{{^authMethods}} Endpoints do not require authorization.
+{{/authMethods}}{{#authMethods}}{{#last}} Authentication schemes defined for the API:{{/last}}{{/authMethods}}
+{{#authMethods}}
+
+## {{{name}}}
+
+{{#isApiKey}}- **Type**: API key
+
+Example
+
+```golang
+auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{
+ Key: "APIKEY",
+ Prefix: "Bearer", // Omit if not necessary.
+})
+r, err := client.Service.Operation(auth, args)
+```
+
+{{/isApiKey}}
+{{#isBasic}}- **Type**: HTTP basic authentication
+
+Example
+
+```golang
+auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{
+ UserName: "username",
+ Password: "password",
+})
+r, err := client.Service.Operation(auth, args)
+```
+
+{{/isBasic}}
+{{#isOAuth}}
+
+- **Type**: OAuth
+- **Flow**: {{{flow}}}
+- **Authorization URL**: {{{authorizationUrl}}}
+- **Scopes**: {{^scopes}}N/A{{/scopes}}
+{{#scopes}} - **{{{scope}}}**: {{{description}}}
+{{/scopes}}
+
+Example
+
+```golang
+auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING")
+r, err := client.Service.Operation(auth, args)
+```
+
+Or via OAuth2 module to automatically refresh tokens and perform user authentication.
+
+```golang
+import "golang.org/x/oauth2"
+
+/* Perform OAuth2 round trip request and obtain a token */
+
+tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token)
+auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource)
+r, err := client.Service.Operation(auth, args)
+```
+
+{{/isOAuth}}
+{{/authMethods}}
+
+## Author
+
+{{#apiInfo}}{{#apis}}{{^hasMore}}{{infoEmail}}
+{{/hasMore}}{{/apis}}{{/apiInfo}}
diff --git a/modules/openapi-generator/src/main/resources/go-experimental/api.mustache b/modules/openapi-generator/src/main/resources/go-experimental/api.mustache
new file mode 100644
index 000000000000..2b04681ac91a
--- /dev/null
+++ b/modules/openapi-generator/src/main/resources/go-experimental/api.mustache
@@ -0,0 +1,322 @@
+{{>partial_header}}
+package {{packageName}}
+
+{{#operations}}
+import (
+ "context"
+ "io/ioutil"
+ "net/http"
+ "net/url"
+{{#imports}} "{{import}}"
+{{/imports}}
+)
+
+// Linger please
+var (
+ _ context.Context
+)
+
+type {{classname}}Service service
+{{#operation}}
+
+/*
+{{{classname}}}Service{{#summary}} {{{.}}}{{/summary}}
+{{#notes}}
+{{notes}}
+{{/notes}}
+ * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
+{{#allParams}}
+{{#required}}
+ * @param {{paramName}}{{#description}} {{{.}}}{{/description}}
+{{/required}}
+{{/allParams}}
+{{#hasOptionalParams}}
+ * @param optional nil or *{{{nickname}}}Opts - Optional Parameters:
+{{#allParams}}
+{{^required}}
+ * @param "{{vendorExtensions.x-exportParamName}}" ({{#isPrimitiveType}}{{^isBinary}}optional.{{vendorExtensions.x-optionalDataType}}{{/isBinary}}{{#isBinary}}optional.Interface of {{dataType}}{{/isBinary}}{{/isPrimitiveType}}{{^isPrimitiveType}}optional.Interface of {{dataType}}{{/isPrimitiveType}}) - {{#description}} {{{.}}}{{/description}}
+{{/required}}
+{{/allParams}}
+{{/hasOptionalParams}}
+{{#returnType}}
+@return {{{returnType}}}
+{{/returnType}}
+*/
+{{#hasOptionalParams}}
+
+type {{{nickname}}}Opts struct {
+{{#allParams}}
+{{^required}}
+{{#isPrimitiveType}}
+{{^isBinary}}
+ {{vendorExtensions.x-exportParamName}} optional.{{vendorExtensions.x-optionalDataType}}
+{{/isBinary}}
+{{#isBinary}}
+ {{vendorExtensions.x-exportParamName}} optional.Interface
+{{/isBinary}}
+{{/isPrimitiveType}}
+{{^isPrimitiveType}}
+ {{vendorExtensions.x-exportParamName}} optional.Interface
+{{/isPrimitiveType}}
+{{/required}}
+{{/allParams}}
+}
+
+{{/hasOptionalParams}}
+func (a *{{{classname}}}Service) {{{nickname}}}(ctx context.Context{{#hasParams}}, {{/hasParams}}{{#allParams}}{{#required}}{{paramName}} {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/required}}{{/allParams}}{{#hasOptionalParams}}localVarOptionals *{{{nickname}}}Opts{{/hasOptionalParams}}) ({{#returnType}}{{{returnType}}}, {{/returnType}}*http.Response, error) {
+ var (
+ localVarHttpMethod = http.Method{{httpMethod}}
+ localVarPostBody interface{}
+ localVarFormFileName string
+ localVarFileName string
+ localVarFileBytes []byte
+ {{#returnType}}
+ localVarReturnValue {{{returnType}}}
+ {{/returnType}}
+ )
+
+ // create path and map variables
+ localVarPath := a.client.cfg.BasePath + "{{{path}}}"{{#pathParams}}
+ localVarPath = strings.Replace(localVarPath, "{"+"{{baseName}}"+"}", fmt.Sprintf("%v", {{paramName}}), -1){{/pathParams}}
+
+ localVarHeaderParams := make(map[string]string)
+ localVarQueryParams := url.Values{}
+ localVarFormParams := url.Values{}
+ {{#allParams}}
+ {{#required}}
+ {{#minItems}}
+ if len({{paramName}}) < {{minItems}} {
+ return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} must have at least {{minItems}} elements")
+ }
+ {{/minItems}}
+ {{#maxItems}}
+ if len({{paramName}}) > {{maxItems}} {
+ return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} must have less than {{maxItems}} elements")
+ }
+ {{/maxItems}}
+ {{#minLength}}
+ if strlen({{paramName}}) < {{minLength}} {
+ return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} must have at least {{minLength}} elements")
+ }
+ {{/minLength}}
+ {{#maxLength}}
+ if strlen({{paramName}}) > {{maxLength}} {
+ return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} must have less than {{maxLength}} elements")
+ }
+ {{/maxLength}}
+ {{#minimum}}
+ {{#isString}}
+ {{paramName}}Txt, err := atoi({{paramName}})
+ if {{paramName}}Txt < {{minimum}} {
+ {{/isString}}
+ {{^isString}}
+ if {{paramName}} < {{minimum}} {
+ {{/isString}}
+ return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} must be greater than {{minimum}}")
+ }
+ {{/minimum}}
+ {{#maximum}}
+ {{#isString}}
+ {{paramName}}Txt, err := atoi({{paramName}})
+ if {{paramName}}Txt > {{maximum}} {
+ {{/isString}}
+ {{^isString}}
+ if {{paramName}} > {{maximum}} {
+ {{/isString}}
+ return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} must be less than {{maximum}}")
+ }
+ {{/maximum}}
+ {{/required}}
+ {{/allParams}}
+
+ {{#hasQueryParams}}
+ {{#queryParams}}
+ {{#required}}
+ localVarQueryParams.Add("{{baseName}}", parameterToString({{paramName}}, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}"))
+ {{/required}}
+ {{^required}}
+ if localVarOptionals != nil && localVarOptionals.{{vendorExtensions.x-exportParamName}}.IsSet() {
+ localVarQueryParams.Add("{{baseName}}", parameterToString(localVarOptionals.{{vendorExtensions.x-exportParamName}}.Value(), "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}"))
+ }
+ {{/required}}
+ {{/queryParams}}
+ {{/hasQueryParams}}
+ // to determine the Content-Type header
+{{=<% %>=}}
+ localVarHttpContentTypes := []string{<%#consumes%>"<%&mediaType%>"<%^-last%>, <%/-last%><%/consumes%>}
+<%={{ }}=%>
+
+ // set Content-Type header
+ localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
+ if localVarHttpContentType != "" {
+ localVarHeaderParams["Content-Type"] = localVarHttpContentType
+ }
+
+ // to determine the Accept header
+{{=<% %>=}}
+ localVarHttpHeaderAccepts := []string{<%#produces%>"<%&mediaType%>"<%^-last%>, <%/-last%><%/produces%>}
+<%={{ }}=%>
+
+ // set Accept header
+ localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
+ if localVarHttpHeaderAccept != "" {
+ localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
+ }
+{{#hasHeaderParams}}
+{{#headerParams}}
+ {{#required}}
+ localVarHeaderParams["{{baseName}}"] = parameterToString({{paramName}}, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}")
+ {{/required}}
+ {{^required}}
+ if localVarOptionals != nil && localVarOptionals.{{vendorExtensions.x-exportParamName}}.IsSet() {
+ localVarHeaderParams["{{baseName}}"] = parameterToString(localVarOptionals.{{vendorExtensions.x-exportParamName}}.Value(), "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}")
+ }
+ {{/required}}
+{{/headerParams}}
+{{/hasHeaderParams}}
+{{#hasFormParams}}
+{{#formParams}}
+{{#isFile}}
+ localVarFormFileName = "{{baseName}}"
+{{#required}}
+ localVarFile := {{paramName}}
+{{/required}}
+{{^required}}
+ var localVarFile {{dataType}}
+ if localVarOptionals != nil && localVarOptionals.{{vendorExtensions.x-exportParamName}}.IsSet() {
+ localVarFileOk := false
+ localVarFile, localVarFileOk = localVarOptionals.{{vendorExtensions.x-exportParamName}}.Value().({{dataType}})
+ if !localVarFileOk {
+ return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} should be {{dataType}}")
+ }
+ }
+{{/required}}
+ if localVarFile != nil {
+ fbs, _ := ioutil.ReadAll(localVarFile)
+ localVarFileBytes = fbs
+ localVarFileName = localVarFile.Name()
+ localVarFile.Close()
+ }
+{{/isFile}}
+{{^isFile}}
+{{#required}}
+ localVarFormParams.Add("{{baseName}}", parameterToString({{paramName}}, "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}"))
+{{/required}}
+{{^required}}
+{{#isModel}}
+ if localVarOptionals != nil && localVarOptionals.{{vendorExtensions.x-exportParamName}}.IsSet() {
+ paramJson, err := parameterToJson(localVarOptionals.{{vendorExtensions.x-exportParamName}}.Value())
+ if err != nil {
+ return {{#returnType}}localVarReturnValue, {{/returnType}}nil, err
+ }
+ localVarFormParams.Add("{{baseName}}", paramJson)
+ }
+{{/isModel}}
+{{^isModel}}
+ if localVarOptionals != nil && localVarOptionals.{{vendorExtensions.x-exportParamName}}.IsSet() {
+ localVarFormParams.Add("{{baseName}}", parameterToString(localVarOptionals.{{vendorExtensions.x-exportParamName}}.Value(), "{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}"))
+ }
+{{/isModel}}
+{{/required}}
+{{/isFile}}
+{{/formParams}}
+{{/hasFormParams}}
+{{#hasBodyParam}}
+{{#bodyParams}}
+ // body params
+{{#required}}
+ localVarPostBody = &{{paramName}}
+{{/required}}
+{{^required}}
+ if localVarOptionals != nil && localVarOptionals.{{vendorExtensions.x-exportParamName}}.IsSet() {
+ {{#isPrimitiveType}}
+ localVarPostBody = localVarOptionals.{{vendorExtensions.x-exportParamName}}.Value()
+ {{/isPrimitiveType}}
+ {{^isPrimitiveType}}
+ localVarOptional{{vendorExtensions.x-exportParamName}}, localVarOptional{{vendorExtensions.x-exportParamName}}ok := localVarOptionals.{{vendorExtensions.x-exportParamName}}.Value().({{{dataType}}})
+ if !localVarOptional{{vendorExtensions.x-exportParamName}}ok {
+ return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} should be {{dataType}}")
+ }
+ localVarPostBody = &localVarOptional{{vendorExtensions.x-exportParamName}}
+ {{/isPrimitiveType}}
+ }
+
+{{/required}}
+{{/bodyParams}}
+{{/hasBodyParam}}
+{{#authMethods}}
+{{#isApiKey}}
+{{^isKeyInCookie}}
+ if ctx != nil {
+ // API Key Authentication
+ if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
+ var key string
+ if auth.Prefix != "" {
+ key = auth.Prefix + " " + auth.Key
+ } else {
+ key = auth.Key
+ }
+ {{#isKeyInHeader}}
+ localVarHeaderParams["{{keyParamName}}"] = key
+ {{/isKeyInHeader}}
+ {{#isKeyInQuery}}
+ localVarQueryParams.Add("{{keyParamName}}", key)
+ {{/isKeyInQuery}}
+ }
+ }
+{{/isKeyInCookie}}
+{{/isApiKey}}
+{{/authMethods}}
+ r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
+ if err != nil {
+ return {{#returnType}}localVarReturnValue, {{/returnType}}nil, err
+ }
+
+ localVarHttpResponse, err := a.client.callAPI(r)
+ if err != nil || localVarHttpResponse == nil {
+ return {{#returnType}}localVarReturnValue, {{/returnType}}localVarHttpResponse, err
+ }
+
+ localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
+ localVarHttpResponse.Body.Close()
+ if err != nil {
+ return {{#returnType}}localVarReturnValue, {{/returnType}}localVarHttpResponse, err
+ }
+
+ if localVarHttpResponse.StatusCode >= 300 {
+ newErr := GenericOpenAPIError{
+ body: localVarBody,
+ error: localVarHttpResponse.Status,
+ }
+ {{#responses}}
+ {{#dataType}}
+ if localVarHttpResponse.StatusCode == {{{code}}} {
+ var v {{{dataType}}}
+ err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
+ if err != nil {
+ newErr.error = err.Error()
+ return {{#returnType}}localVarReturnValue, {{/returnType}}localVarHttpResponse, newErr
+ }
+ newErr.model = v
+ return {{#returnType}}localVarReturnValue, {{/returnType}}localVarHttpResponse, newErr
+ }
+ {{/dataType}}
+ {{/responses}}
+ return {{#returnType}}localVarReturnValue, {{/returnType}}localVarHttpResponse, newErr
+ }
+
+ {{#returnType}}
+ err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
+ if err != nil {
+ newErr := GenericOpenAPIError{
+ body: localVarBody,
+ error: err.Error(),
+ }
+ return {{#returnType}}localVarReturnValue, {{/returnType}}localVarHttpResponse, newErr
+ }
+
+ {{/returnType}}
+ return {{#returnType}}localVarReturnValue, {{/returnType}}localVarHttpResponse, nil
+}
+{{/operation}}
+{{/operations}}
diff --git a/modules/openapi-generator/src/main/resources/go-experimental/api_doc.mustache b/modules/openapi-generator/src/main/resources/go-experimental/api_doc.mustache
new file mode 100644
index 000000000000..2ac67bb22210
--- /dev/null
+++ b/modules/openapi-generator/src/main/resources/go-experimental/api_doc.mustache
@@ -0,0 +1,58 @@
+# {{invokerPackage}}\{{classname}}{{#description}}
+
+{{description}}{{/description}}
+
+All URIs are relative to *{{basePath}}*
+
+Method | HTTP request | Description
+------------- | ------------- | -------------
+{{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}}
+{{/operation}}{{/operations}}
+
+{{#operations}}
+{{#operation}}
+
+## {{{operationId}}}
+
+> {{#returnType}}{{{returnType}}} {{/returnType}}{{{operationId}}}(ctx, {{#allParams}}{{#required}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/required}}{{/allParams}}{{#hasOptionalParams}}optional{{/hasOptionalParams}})
+{{{summary}}}{{#notes}}
+
+{{{notes}}}{{/notes}}
+
+### Required Parameters
+
+{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}}
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.{{/-last}}{{/allParams}}{{#allParams}}{{#required}}
+**{{paramName}}** | {{#isFile}}**{{dataType}}**{{/isFile}}{{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isFile}}[**{{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} | {{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}{{/required}}{{/allParams}}{{#hasOptionalParams}}
+ **optional** | ***{{{nickname}}}Opts** | optional parameters | nil if no parameters
+
+### Optional Parameters
+
+Optional parameters are passed through a pointer to a {{{nickname}}}Opts struct
+{{#allParams}}{{#-last}}
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}}{{#allParams}}
+{{^required}} **{{paramName}}** | {{#isFile}}**optional.Interface of {{dataType}}**{{/isFile}}{{#isPrimitiveType}}**optional.{{vendorExtensions.x-optionalDataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isFile}}[**optional.Interface of {{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} | {{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}{{/required}}{{/allParams}}{{/hasOptionalParams}}
+
+### Return type
+
+{{#returnType}}{{#returnTypeIsPrimitive}}**{{{returnType}}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{{returnType}}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}} (empty response body){{/returnType}}
+
+### Authorization
+
+{{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{{name}}}](../README.md#{{{name}}}){{^-last}}, {{/-last}}{{/authMethods}}
+
+### HTTP request headers
+
+- **Content-Type**: {{#consumes}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/consumes}}{{^consumes}}Not defined{{/consumes}}
+- **Accept**: {{#produces}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/produces}}{{^produces}}Not defined{{/produces}}
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
+[[Back to Model list]](../README.md#documentation-for-models)
+[[Back to README]](../README.md)
+
+{{/operation}}
+{{/operations}}
diff --git a/modules/openapi-generator/src/main/resources/go-experimental/client.mustache b/modules/openapi-generator/src/main/resources/go-experimental/client.mustache
new file mode 100644
index 000000000000..1c4241ff043b
--- /dev/null
+++ b/modules/openapi-generator/src/main/resources/go-experimental/client.mustache
@@ -0,0 +1,503 @@
+{{>partial_header}}
+package {{packageName}}
+
+import (
+ "bytes"
+ "context"
+ "encoding/json"
+ "encoding/xml"
+ "errors"
+ "fmt"
+ "io"
+ "mime/multipart"
+ "net/http"
+ "net/url"
+ "os"
+ "path/filepath"
+ "reflect"
+ "regexp"
+ "strconv"
+ "strings"
+ "time"
+ "unicode/utf8"
+
+ "golang.org/x/oauth2"
+)
+
+var (
+ jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`)
+ xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`)
+)
+
+// APIClient manages communication with the {{appName}} API v{{version}}
+// In most cases there should be only one, shared, APIClient.
+type APIClient struct {
+ cfg *Configuration
+ common service // Reuse a single struct instead of allocating one for each service on the heap.
+
+ // API Services
+{{#apiInfo}}
+{{#apis}}
+{{#operations}}
+
+ {{classname}} *{{classname}}Service
+{{/operations}}
+{{/apis}}
+{{/apiInfo}}
+}
+
+type service struct {
+ client *APIClient
+}
+
+// NewAPIClient creates a new API client. Requires a userAgent string describing your application.
+// optionally a custom http.Client to allow for advanced features such as caching.
+func NewAPIClient(cfg *Configuration) *APIClient {
+ if cfg.HTTPClient == nil {
+ cfg.HTTPClient = http.DefaultClient
+ }
+
+ c := &APIClient{}
+ c.cfg = cfg
+ c.common.client = c
+
+{{#apiInfo}}
+ // API Services
+{{#apis}}
+{{#operations}}
+ c.{{classname}} = (*{{classname}}Service)(&c.common)
+{{/operations}}
+{{/apis}}
+{{/apiInfo}}
+
+ return c
+}
+
+func atoi(in string) (int, error) {
+ return strconv.Atoi(in)
+}
+
+// selectHeaderContentType select a content type from the available list.
+func selectHeaderContentType(contentTypes []string) string {
+ if len(contentTypes) == 0 {
+ return ""
+ }
+ if contains(contentTypes, "application/json") {
+ return "application/json"
+ }
+ return contentTypes[0] // use the first content type specified in 'consumes'
+}
+
+// selectHeaderAccept join all accept types and return
+func selectHeaderAccept(accepts []string) string {
+ if len(accepts) == 0 {
+ return ""
+ }
+
+ if contains(accepts, "application/json") {
+ return "application/json"
+ }
+
+ return strings.Join(accepts, ",")
+}
+
+// contains is a case insenstive match, finding needle in a haystack
+func contains(haystack []string, needle string) bool {
+ for _, a := range haystack {
+ if strings.ToLower(a) == strings.ToLower(needle) {
+ return true
+ }
+ }
+ return false
+}
+
+// Verify optional parameters are of the correct type.
+func typeCheckParameter(obj interface{}, expected string, name string) error {
+ // Make sure there is an object.
+ if obj == nil {
+ return nil
+ }
+
+ // Check the type is as expected.
+ if reflect.TypeOf(obj).String() != expected {
+ return fmt.Errorf("Expected %s to be of type %s but received %s.", name, expected, reflect.TypeOf(obj).String())
+ }
+ return nil
+}
+
+// parameterToString convert interface{} parameters to string, using a delimiter if format is provided.
+func parameterToString(obj interface{}, collectionFormat string) string {
+ var delimiter string
+
+ switch collectionFormat {
+ case "pipes":
+ delimiter = "|"
+ case "ssv":
+ delimiter = " "
+ case "tsv":
+ delimiter = "\t"
+ case "csv":
+ delimiter = ","
+ }
+
+ if reflect.TypeOf(obj).Kind() == reflect.Slice {
+ return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]")
+ } else if t, ok := obj.(time.Time); ok {
+ return t.Format(time.RFC3339)
+ }
+
+ return fmt.Sprintf("%v", obj)
+}
+
+// helper for converting interface{} parameters to json strings
+func parameterToJson(obj interface{}) (string, error) {
+ jsonBuf, err := json.Marshal(obj)
+ if err != nil {
+ return "", err
+ }
+ return string(jsonBuf), err
+}
+
+
+// callAPI do the request.
+func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) {
+ return c.cfg.HTTPClient.Do(request)
+}
+
+// Change base path to allow switching to mocks
+func (c *APIClient) ChangeBasePath(path string) {
+ c.cfg.BasePath = path
+}
+
+// prepareRequest build the request
+func (c *APIClient) prepareRequest(
+ ctx context.Context,
+ path string, method string,
+ postBody interface{},
+ headerParams map[string]string,
+ queryParams url.Values,
+ formParams url.Values,
+ formFileName string,
+ fileName string,
+ fileBytes []byte) (localVarRequest *http.Request, err error) {
+
+ var body *bytes.Buffer
+
+ // Detect postBody type and post.
+ if postBody != nil {
+ contentType := headerParams["Content-Type"]
+ if contentType == "" {
+ contentType = detectContentType(postBody)
+ headerParams["Content-Type"] = contentType
+ }
+
+ body, err = setBody(postBody, contentType)
+ if err != nil {
+ return nil, err
+ }
+ }
+
+ // add form parameters and file if available.
+ if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(fileBytes) > 0 && fileName != "") {
+ if body != nil {
+ return nil, errors.New("Cannot specify postBody and multipart form at the same time.")
+ }
+ body = &bytes.Buffer{}
+ w := multipart.NewWriter(body)
+
+ for k, v := range formParams {
+ for _, iv := range v {
+ if strings.HasPrefix(k, "@") { // file
+ err = addFile(w, k[1:], iv)
+ if err != nil {
+ return nil, err
+ }
+ } else { // form value
+ w.WriteField(k, iv)
+ }
+ }
+ }
+ if len(fileBytes) > 0 && fileName != "" {
+ w.Boundary()
+ //_, fileNm := filepath.Split(fileName)
+ part, err := w.CreateFormFile(formFileName, filepath.Base(fileName))
+ if err != nil {
+ return nil, err
+ }
+ _, err = part.Write(fileBytes)
+ if err != nil {
+ return nil, err
+ }
+ }
+
+ // Set the Boundary in the Content-Type
+ headerParams["Content-Type"] = w.FormDataContentType()
+
+ // Set Content-Length
+ headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len())
+ w.Close()
+ }
+
+ if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 {
+ if body != nil {
+ return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.")
+ }
+ body = &bytes.Buffer{}
+ body.WriteString(formParams.Encode())
+ // Set Content-Length
+ headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len())
+ }
+
+ // Setup path and query parameters
+ url, err := url.Parse(path)
+ if err != nil {
+ return nil, err
+ }
+
+ // Override request host, if applicable
+ if c.cfg.Host != "" {
+ url.Host = c.cfg.Host
+ }
+
+ // Override request scheme, if applicable
+ if c.cfg.Scheme != "" {
+ url.Scheme = c.cfg.Scheme
+ }
+
+ // Adding Query Param
+ query := url.Query()
+ for k, v := range queryParams {
+ for _, iv := range v {
+ query.Add(k, iv)
+ }
+ }
+
+ // Encode the parameters.
+ url.RawQuery = query.Encode()
+
+ // Generate a new request
+ if body != nil {
+ localVarRequest, err = http.NewRequest(method, url.String(), body)
+ } else {
+ localVarRequest, err = http.NewRequest(method, url.String(), nil)
+ }
+ if err != nil {
+ return nil, err
+ }
+
+ // add header parameters, if any
+ if len(headerParams) > 0 {
+ headers := http.Header{}
+ for h, v := range headerParams {
+ headers.Set(h, v)
+ }
+ localVarRequest.Header = headers
+ }
+
+ // Add the user agent to the request.
+ localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent)
+
+ if ctx != nil {
+ // add context to the request
+ localVarRequest = localVarRequest.WithContext(ctx)
+
+ // Walk through any authentication.
+
+ // OAuth2 authentication
+ if tok, ok := ctx.Value(ContextOAuth2).(oauth2.TokenSource); ok {
+ // We were able to grab an oauth2 token from the context
+ var latestToken *oauth2.Token
+ if latestToken, err = tok.Token(); err != nil {
+ return nil, err
+ }
+
+ latestToken.SetAuthHeader(localVarRequest)
+ }
+
+ // Basic HTTP Authentication
+ if auth, ok := ctx.Value(ContextBasicAuth).(BasicAuth); ok {
+ localVarRequest.SetBasicAuth(auth.UserName, auth.Password)
+ }
+
+ // AccessToken Authentication
+ if auth, ok := ctx.Value(ContextAccessToken).(string); ok {
+ localVarRequest.Header.Add("Authorization", "Bearer "+auth)
+ }
+ }
+
+ for header, value := range c.cfg.DefaultHeader {
+ localVarRequest.Header.Add(header, value)
+ }
+
+ return localVarRequest, nil
+}
+
+func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) {
+ if s, ok := v.(*string); ok {
+ *s = string(b)
+ return nil
+ }
+ if xmlCheck.MatchString(contentType) {
+ if err = xml.Unmarshal(b, v); err != nil {
+ return err
+ }
+ return nil
+ }
+ if jsonCheck.MatchString(contentType) {
+ if err = json.Unmarshal(b, v); err != nil {
+ return err
+ }
+ return nil
+ }
+ return errors.New("undefined response type")
+}
+
+// Add a file to the multipart request
+func addFile(w *multipart.Writer, fieldName, path string) error {
+ file, err := os.Open(path)
+ if err != nil {
+ return err
+ }
+ defer file.Close()
+
+ part, err := w.CreateFormFile(fieldName, filepath.Base(path))
+ if err != nil {
+ return err
+ }
+ _, err = io.Copy(part, file)
+
+ return err
+}
+
+// Prevent trying to import "fmt"
+func reportError(format string, a ...interface{}) error {
+ return fmt.Errorf(format, a...)
+}
+
+// Set request body from an interface{}
+func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) {
+ if bodyBuf == nil {
+ bodyBuf = &bytes.Buffer{}
+ }
+
+ if reader, ok := body.(io.Reader); ok {
+ _, err = bodyBuf.ReadFrom(reader)
+ } else if b, ok := body.([]byte); ok {
+ _, err = bodyBuf.Write(b)
+ } else if s, ok := body.(string); ok {
+ _, err = bodyBuf.WriteString(s)
+ } else if s, ok := body.(*string); ok {
+ _, err = bodyBuf.WriteString(*s)
+ } else if jsonCheck.MatchString(contentType) {
+ err = json.NewEncoder(bodyBuf).Encode(body)
+ } else if xmlCheck.MatchString(contentType) {
+ err = xml.NewEncoder(bodyBuf).Encode(body)
+ }
+
+ if err != nil {
+ return nil, err
+ }
+
+ if bodyBuf.Len() == 0 {
+ err = fmt.Errorf("Invalid body type %s\n", contentType)
+ return nil, err
+ }
+ return bodyBuf, nil
+}
+
+// detectContentType method is used to figure out `Request.Body` content type for request header
+func detectContentType(body interface{}) string {
+ contentType := "text/plain; charset=utf-8"
+ kind := reflect.TypeOf(body).Kind()
+
+ switch kind {
+ case reflect.Struct, reflect.Map, reflect.Ptr:
+ contentType = "application/json; charset=utf-8"
+ case reflect.String:
+ contentType = "text/plain; charset=utf-8"
+ default:
+ if b, ok := body.([]byte); ok {
+ contentType = http.DetectContentType(b)
+ } else if kind == reflect.Slice {
+ contentType = "application/json; charset=utf-8"
+ }
+ }
+
+ return contentType
+}
+
+// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go
+type cacheControl map[string]string
+
+func parseCacheControl(headers http.Header) cacheControl {
+ cc := cacheControl{}
+ ccHeader := headers.Get("Cache-Control")
+ for _, part := range strings.Split(ccHeader, ",") {
+ part = strings.Trim(part, " ")
+ if part == "" {
+ continue
+ }
+ if strings.ContainsRune(part, '=') {
+ keyval := strings.Split(part, "=")
+ cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",")
+ } else {
+ cc[part] = ""
+ }
+ }
+ return cc
+}
+
+// CacheExpires helper function to determine remaining time before repeating a request.
+func CacheExpires(r *http.Response) time.Time {
+ // Figure out when the cache expires.
+ var expires time.Time
+ now, err := time.Parse(time.RFC1123, r.Header.Get("date"))
+ if err != nil {
+ return time.Now()
+ }
+ respCacheControl := parseCacheControl(r.Header)
+
+ if maxAge, ok := respCacheControl["max-age"]; ok {
+ lifetime, err := time.ParseDuration(maxAge + "s")
+ if err != nil {
+ expires = now
+ } else {
+ expires = now.Add(lifetime)
+ }
+ } else {
+ expiresHeader := r.Header.Get("Expires")
+ if expiresHeader != "" {
+ expires, err = time.Parse(time.RFC1123, expiresHeader)
+ if err != nil {
+ expires = now
+ }
+ }
+ }
+ return expires
+}
+
+func strlen(s string) int {
+ return utf8.RuneCountInString(s)
+}
+
+// GenericOpenAPIError Provides access to the body, error and model on returned errors.
+type GenericOpenAPIError struct {
+ body []byte
+ error string
+ model interface{}
+}
+
+// Error returns non-empty string if there was an error.
+func (e GenericOpenAPIError) Error() string {
+ return e.error
+}
+
+// Body returns the raw bytes of the response
+func (e GenericOpenAPIError) Body() []byte {
+ return e.body
+}
+
+// Model returns the unpacked model of the error
+func (e GenericOpenAPIError) Model() interface{} {
+ return e.model
+}
diff --git a/modules/openapi-generator/src/main/resources/go-experimental/configuration.mustache b/modules/openapi-generator/src/main/resources/go-experimental/configuration.mustache
new file mode 100644
index 000000000000..81d3a41b7bdf
--- /dev/null
+++ b/modules/openapi-generator/src/main/resources/go-experimental/configuration.mustache
@@ -0,0 +1,64 @@
+{{>partial_header}}
+package {{packageName}}
+
+import (
+ "net/http"
+)
+
+// contextKeys are used to identify the type of value in the context.
+// Since these are string, it is possible to get a short description of the
+// context key for logging and debugging using key.String().
+
+type contextKey string
+
+func (c contextKey) String() string {
+ return "auth " + string(c)
+}
+
+var (
+ // ContextOAuth2 takes an oauth2.TokenSource as authentication for the request.
+ ContextOAuth2 = contextKey("token")
+
+ // ContextBasicAuth takes BasicAuth as authentication for the request.
+ ContextBasicAuth = contextKey("basic")
+
+ // ContextAccessToken takes a string oauth2 access token as authentication for the request.
+ ContextAccessToken = contextKey("accesstoken")
+
+ // ContextAPIKey takes an APIKey as authentication for the request
+ ContextAPIKey = contextKey("apikey")
+)
+
+// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth
+type BasicAuth struct {
+ UserName string `json:"userName,omitempty"`
+ Password string `json:"password,omitempty"`
+}
+
+// APIKey provides API key based authentication to a request passed via context using ContextAPIKey
+type APIKey struct {
+ Key string
+ Prefix string
+}
+
+type Configuration struct {
+ BasePath string `json:"basePath,omitempty"`
+ Host string `json:"host,omitempty"`
+ Scheme string `json:"scheme,omitempty"`
+ DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
+ UserAgent string `json:"userAgent,omitempty"`
+ HTTPClient *http.Client
+}
+
+func NewConfiguration() *Configuration {
+ cfg := &Configuration{
+ BasePath: "{{{basePath}}}",
+ DefaultHeader: make(map[string]string),
+ UserAgent: "{{#httpUserAgent}}{{{.}}}{{/httpUserAgent}}{{^httpUserAgent}}OpenAPI-Generator/{{{packageVersion}}}/go{{/httpUserAgent}}",
+ }
+ return cfg
+}
+
+func (c *Configuration) AddDefaultHeader(key string, value string) {
+ c.DefaultHeader[key] = value
+}
diff --git a/modules/openapi-generator/src/main/resources/go-experimental/git_push.sh.mustache b/modules/openapi-generator/src/main/resources/go-experimental/git_push.sh.mustache
new file mode 100755
index 000000000000..8a32e53995d6
--- /dev/null
+++ b/modules/openapi-generator/src/main/resources/go-experimental/git_push.sh.mustache
@@ -0,0 +1,52 @@
+#!/bin/sh
+# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
+#
+# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update"
+
+git_user_id=$1
+git_repo_id=$2
+release_note=$3
+
+if [ "$git_user_id" = "" ]; then
+ git_user_id="{{{gitUserId}}}"
+ echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
+fi
+
+if [ "$git_repo_id" = "" ]; then
+ git_repo_id="{{{gitRepoId}}}"
+ echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
+fi
+
+if [ "$release_note" = "" ]; then
+ release_note="{{{releaseNote}}}"
+ echo "[INFO] No command line input provided. Set \$release_note to $release_note"
+fi
+
+# Initialize the local directory as a Git repository
+git init
+
+# Adds the files in the local repository and stages them for commit.
+git add .
+
+# Commits the tracked changes and prepares them to be pushed to a remote repository.
+git commit -m "$release_note"
+
+# Sets the new remote
+git_remote=`git remote`
+if [ "$git_remote" = "" ]; then # git remote not defined
+
+ if [ "$GIT_TOKEN" = "" ]; then
+ echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
+ git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
+ else
+ git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
+ fi
+
+fi
+
+git pull origin master
+
+# Pushes (Forces) the changes in the local repository up to the remote repository
+echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
+git push origin master 2>&1 | grep -v 'To https'
+
diff --git a/modules/openapi-generator/src/main/resources/go-experimental/gitignore.mustache b/modules/openapi-generator/src/main/resources/go-experimental/gitignore.mustache
new file mode 100644
index 000000000000..daf913b1b347
--- /dev/null
+++ b/modules/openapi-generator/src/main/resources/go-experimental/gitignore.mustache
@@ -0,0 +1,24 @@
+# Compiled Object files, Static and Dynamic libs (Shared Objects)
+*.o
+*.a
+*.so
+
+# Folders
+_obj
+_test
+
+# Architecture specific extensions/prefixes
+*.[568vq]
+[568vq].out
+
+*.cgo1.go
+*.cgo2.c
+_cgo_defun.c
+_cgo_gotypes.go
+_cgo_export.*
+
+_testmain.go
+
+*.exe
+*.test
+*.prof
diff --git a/modules/openapi-generator/src/main/resources/go-experimental/go.mod.mustache b/modules/openapi-generator/src/main/resources/go-experimental/go.mod.mustache
new file mode 100644
index 000000000000..ec4310dd5932
--- /dev/null
+++ b/modules/openapi-generator/src/main/resources/go-experimental/go.mod.mustache
@@ -0,0 +1,6 @@
+module github.com/{{gitUserId}}/{{gitRepoId}}{{#isGoSubmodule}}/{{packageName}}{{/isGoSubmodule}}
+
+require (
+ github.com/antihax/optional v0.0.0-20180406194304-ca021399b1a6
+ golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a
+)
diff --git a/modules/openapi-generator/src/main/resources/go-experimental/go.sum b/modules/openapi-generator/src/main/resources/go-experimental/go.sum
new file mode 100644
index 000000000000..e3c16fef3ac1
--- /dev/null
+++ b/modules/openapi-generator/src/main/resources/go-experimental/go.sum
@@ -0,0 +1,11 @@
+cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
+github.com/antihax/optional v0.0.0-20180406194304-ca021399b1a6/go.mod h1:V8iCPQYkqmusNa815XgQio277wI47sdRh1dUOLdyC6Q=
+github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
+golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e h1:bRhVy7zSSasaqNksaRZiA5EEI+Ei4I1nO5Jh72wfHlg=
+golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a h1:tImsplftrFpALCYumobsd0K86vlAs/eXGFms2txfJfA=
+golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
+golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
+google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
diff --git a/modules/openapi-generator/src/main/resources/go-experimental/model.mustache b/modules/openapi-generator/src/main/resources/go-experimental/model.mustache
new file mode 100644
index 000000000000..1a9f8d1c5aaf
--- /dev/null
+++ b/modules/openapi-generator/src/main/resources/go-experimental/model.mustache
@@ -0,0 +1,43 @@
+{{>partial_header}}
+package {{packageName}}
+{{#models}}
+{{#imports}}
+{{#-first}}
+import (
+{{/-first}}
+ "{{import}}"
+{{#-last}}
+)
+{{/-last}}
+{{/imports}}
+{{#model}}
+{{#isEnum}}
+{{#description}}
+// {{{classname}}} : {{{description}}}
+{{/description}}
+type {{{classname}}} {{^format}}{{dataType}}{{/format}}{{#format}}{{{format}}}{{/format}}
+
+// List of {{{name}}}
+const (
+ {{#allowableValues}}
+ {{#enumVars}}
+ {{^-first}}
+ {{/-first}}
+ {{name}} {{{classname}}} = "{{{value}}}"
+ {{/enumVars}}
+ {{/allowableValues}}
+){{/isEnum}}{{^isEnum}}{{#description}}
+// {{{description}}}{{/description}}
+type {{classname}} struct {
+{{#vars}}
+{{^-first}}
+{{/-first}}
+{{#description}}
+ // {{{description}}}
+{{/description}}
+ {{name}} {{#isNullable}}*{{/isNullable}}{{{dataType}}} `json:"{{baseName}}{{^required}},omitempty{{/required}}"{{#withXml}} xml:"{{baseName}}{{#isXmlAttribute}},attr{{/isXmlAttribute}}"{{/withXml}}{{#vendorExtensions.x-go-custom-tag}} {{{.}}}{{/vendorExtensions.x-go-custom-tag}}`
+{{/vars}}
+}
+{{/isEnum}}
+{{/model}}
+{{/models}}
diff --git a/modules/openapi-generator/src/main/resources/go-experimental/model_doc.mustache b/modules/openapi-generator/src/main/resources/go-experimental/model_doc.mustache
new file mode 100644
index 000000000000..546238243b10
--- /dev/null
+++ b/modules/openapi-generator/src/main/resources/go-experimental/model_doc.mustache
@@ -0,0 +1,12 @@
+{{#models}}{{#model}}# {{classname}}
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+{{#vars}}**{{name}}** | {{#isNullable}}Pointer to {{/isNullable}}{{#isPrimitiveType}}**{{{dataType}}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{{dataType}}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#readOnly}}[readonly] {{/readOnly}}{{#defaultValue}}[default to {{{.}}}]{{/defaultValue}}
+{{/vars}}
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+{{/model}}{{/models}}
diff --git a/modules/openapi-generator/src/main/resources/go-experimental/openapi.mustache b/modules/openapi-generator/src/main/resources/go-experimental/openapi.mustache
new file mode 100644
index 000000000000..51ebafb0187d
--- /dev/null
+++ b/modules/openapi-generator/src/main/resources/go-experimental/openapi.mustache
@@ -0,0 +1 @@
+{{{openapi-yaml}}}
\ No newline at end of file
diff --git a/modules/openapi-generator/src/main/resources/go-experimental/partial_header.mustache b/modules/openapi-generator/src/main/resources/go-experimental/partial_header.mustache
new file mode 100644
index 000000000000..e23b21520a9f
--- /dev/null
+++ b/modules/openapi-generator/src/main/resources/go-experimental/partial_header.mustache
@@ -0,0 +1,23 @@
+/*
+ {{#appName}}
+ * {{{appName}}}
+ *
+ {{/appName}}
+ {{#appDescription}}
+ * {{{appDescription}}}
+ *
+ {{/appDescription}}
+ {{#version}}
+ * API version: {{{version}}}
+ {{/version}}
+ {{#infoEmail}}
+ * Contact: {{{infoEmail}}}
+ {{/infoEmail}}
+{{^withGoCodegenComment}}
+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)
+{{/withGoCodegenComment}}
+ */
+{{#withGoCodegenComment}}
+
+// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
+{{/withGoCodegenComment}}
diff --git a/modules/openapi-generator/src/main/resources/go-experimental/response.mustache b/modules/openapi-generator/src/main/resources/go-experimental/response.mustache
new file mode 100644
index 000000000000..e15d7e6a7835
--- /dev/null
+++ b/modules/openapi-generator/src/main/resources/go-experimental/response.mustache
@@ -0,0 +1,35 @@
+{{>partial_header}}
+package {{packageName}}
+
+import (
+ "net/http"
+)
+
+type APIResponse struct {
+ *http.Response `json:"-"`
+ Message string `json:"message,omitempty"`
+ // Operation is the name of the OpenAPI operation.
+ Operation string `json:"operation,omitempty"`
+ // RequestURL is the request URL. This value is always available, even if the
+ // embedded *http.Response is nil.
+ RequestURL string `json:"url,omitempty"`
+ // Method is the HTTP method used for the request. This value is always
+ // available, even if the embedded *http.Response is nil.
+ Method string `json:"method,omitempty"`
+ // Payload holds the contents of the response body (which may be nil or empty).
+ // This is provided here as the raw response.Body() reader will have already
+ // been drained.
+ Payload []byte `json:"-"`
+}
+
+func NewAPIResponse(r *http.Response) *APIResponse {
+
+ response := &APIResponse{Response: r}
+ return response
+}
+
+func NewAPIResponseWithError(errorMessage string) *APIResponse {
+
+ response := &APIResponse{Message: errorMessage}
+ return response
+}
diff --git a/pom.xml b/pom.xml
index 9e42bba2ad2e..173eb3951acb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1080,6 +1080,7 @@
samples/client/petstore/go
+ samples/client/petstore/go-experimental
samples/client/petstore/scala-httpclient
@@ -1254,7 +1255,7 @@
samples/client/petstore/R
- samples/client/petstore/haskell-http-client
+
samples/server/petstore/haskell-servant
diff --git a/samples/client/petstore/go-experimental/auth_test.go b/samples/client/petstore/go-experimental/auth_test.go
new file mode 100644
index 000000000000..5f817703a886
--- /dev/null
+++ b/samples/client/petstore/go-experimental/auth_test.go
@@ -0,0 +1,254 @@
+package main
+
+import (
+ "context"
+ "net/http"
+ "net/http/httputil"
+ "strings"
+ "testing"
+ "time"
+
+ "golang.org/x/oauth2"
+
+ sw "./go-petstore"
+)
+
+func TestOAuth2(t *testing.T) {
+ // Setup some fake oauth2 configuration
+ cfg := &oauth2.Config{
+ ClientID: "1234567",
+ ClientSecret: "SuperSecret",
+ Endpoint: oauth2.Endpoint{
+ AuthURL: "https://devnull",
+ TokenURL: "https://devnull",
+ },
+ RedirectURL: "https://devnull",
+ }
+
+ // and a fake token
+ tok := oauth2.Token{
+ AccessToken: "FAKE",
+ RefreshToken: "So Fake",
+ Expiry: time.Now().Add(time.Hour * 100000),
+ TokenType: "Bearer",
+ }
+
+ // then a fake tokenSource
+ tokenSource := cfg.TokenSource(createContext(nil), &tok)
+ auth := context.WithValue(context.Background(), sw.ContextOAuth2, tokenSource)
+
+ newPet := (sw.Pet{Id: 12992, Name: "gopher",
+ PhotoUrls: []string{"http://1.com", "http://2.com"}, Status: "pending", Tags: []sw.Tag{sw.Tag{Id: 1, Name: "tag2"}}})
+
+ r, err := client.PetApi.AddPet(context.Background(), newPet)
+
+ if err != nil {
+ t.Fatalf("Error while adding pet: %v", err)
+ }
+ if r.StatusCode != 200 {
+ t.Log(r)
+ }
+
+ r, err = client.PetApi.DeletePet(auth, 12992, nil)
+
+ if err != nil {
+ t.Fatalf("Error while deleting pet by id: %v", err)
+ }
+ if r.StatusCode != 200 {
+ t.Log(r)
+ }
+ reqb, _ := httputil.DumpRequest(r.Request, true)
+
+ if !strings.Contains((string)(reqb), "Authorization: Bearer FAKE") {
+ t.Errorf("OAuth2 Authentication is missing")
+ }
+}
+
+func TestBasicAuth(t *testing.T) {
+
+ auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{
+ UserName: "fakeUser",
+ Password: "f4k3p455",
+ })
+
+ newPet := (sw.Pet{Id: 12992, Name: "gopher",
+ PhotoUrls: []string{"http://1.com", "http://2.com"}, Status: "pending", Tags: []sw.Tag{sw.Tag{Id: 1, Name: "tag2"}}})
+
+ r, err := client.PetApi.AddPet(auth, newPet)
+
+ if err != nil {
+ t.Fatalf("Error while adding pet: %v", err)
+ }
+ if r.StatusCode != 200 {
+ t.Log(r)
+ }
+
+ r, err = client.PetApi.DeletePet(auth, 12992, nil)
+
+ if err != nil {
+ t.Fatalf("Error while deleting pet by id: %v", err)
+ }
+ if r.StatusCode != 200 {
+ t.Log(r)
+ }
+ reqb, _ := httputil.DumpRequest(r.Request, true)
+ if !strings.Contains((string)(reqb), "Authorization: Basic ZmFrZVVzZXI6ZjRrM3A0NTU") {
+ t.Errorf("Basic Authentication is missing")
+ }
+}
+
+func TestAccessToken(t *testing.T) {
+ auth := context.WithValue(context.Background(), sw.ContextAccessToken, "TESTFAKEACCESSTOKENISFAKE")
+
+ newPet := (sw.Pet{Id: 12992, Name: "gopher",
+ PhotoUrls: []string{"http://1.com", "http://2.com"}, Status: "pending", Tags: []sw.Tag{sw.Tag{Id: 1, Name: "tag2"}}})
+
+ r, err := client.PetApi.AddPet(nil, newPet)
+
+ if err != nil {
+ t.Fatalf("Error while adding pet: %v", err)
+ }
+ if r.StatusCode != 200 {
+ t.Log(r)
+ }
+
+ r, err = client.PetApi.DeletePet(auth, 12992, nil)
+
+ if err != nil {
+ t.Fatalf("Error while deleting pet by id: %v", err)
+ }
+ if r.StatusCode != 200 {
+ t.Log(r)
+ }
+ reqb, _ := httputil.DumpRequest(r.Request, true)
+ if !strings.Contains((string)(reqb), "Authorization: Bearer TESTFAKEACCESSTOKENISFAKE") {
+ t.Errorf("AccessToken Authentication is missing")
+ }
+}
+
+func TestAPIKeyNoPrefix(t *testing.T) {
+ auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{Key: "TEST123"})
+
+ newPet := (sw.Pet{Id: 12992, Name: "gopher",
+ PhotoUrls: []string{"http://1.com", "http://2.com"}, Status: "pending", Tags: []sw.Tag{sw.Tag{Id: 1, Name: "tag2"}}})
+
+ r, err := client.PetApi.AddPet(context.Background(), newPet)
+
+ if err != nil {
+ t.Fatalf("Error while adding pet: %v", err)
+ }
+ if r.StatusCode != 200 {
+ t.Log(r)
+ }
+
+ _, r, err = client.PetApi.GetPetById(auth, 12992)
+ if err != nil {
+ t.Fatalf("Error while deleting pet by id: %v", err)
+ }
+
+ reqb, _ := httputil.DumpRequest(r.Request, true)
+ if !strings.Contains((string)(reqb), "Api_key: TEST123") {
+ t.Errorf("APIKey Authentication is missing")
+ }
+
+ r, err = client.PetApi.DeletePet(auth, 12992, nil)
+ if err != nil {
+ t.Fatalf("Error while deleting pet by id: %v", err)
+ }
+ if r.StatusCode != 200 {
+ t.Log(r)
+ }
+}
+
+func TestAPIKeyWithPrefix(t *testing.T) {
+ auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{Key: "TEST123", Prefix: "Bearer"})
+
+ newPet := (sw.Pet{Id: 12992, Name: "gopher",
+ PhotoUrls: []string{"http://1.com", "http://2.com"}, Status: "pending", Tags: []sw.Tag{sw.Tag{Id: 1, Name: "tag2"}}})
+
+ r, err := client.PetApi.AddPet(nil, newPet)
+
+ if err != nil {
+ t.Fatalf("Error while adding pet: %v", err)
+ }
+ if r.StatusCode != 200 {
+ t.Log(r)
+ }
+
+ _, r, err = client.PetApi.GetPetById(auth, 12992)
+ if err != nil {
+ t.Fatalf("Error while deleting pet by id: %v", err)
+ }
+
+ reqb, _ := httputil.DumpRequest(r.Request, true)
+ if !strings.Contains((string)(reqb), "Api_key: Bearer TEST123") {
+ t.Errorf("APIKey Authentication is missing")
+ }
+
+ r, err = client.PetApi.DeletePet(auth, 12992, nil)
+ if err != nil {
+ t.Fatalf("Error while deleting pet by id: %v", err)
+ }
+ if r.StatusCode != 200 {
+ t.Log(r)
+ }
+}
+
+func TestDefaultHeader(t *testing.T) {
+
+ newPet := (sw.Pet{Id: 12992, Name: "gopher",
+ PhotoUrls: []string{"http://1.com", "http://2.com"}, Status: "pending", Tags: []sw.Tag{sw.Tag{Id: 1, Name: "tag2"}}})
+
+ r, err := client.PetApi.AddPet(context.Background(), newPet)
+
+ if err != nil {
+ t.Fatalf("Error while adding pet: %v", err)
+ }
+ if r.StatusCode != 200 {
+ t.Log(r)
+ }
+
+ r, err = client.PetApi.DeletePet(context.Background(), 12992, nil)
+
+ if err != nil {
+ t.Fatalf("Error while deleting pet by id: %v", err)
+ }
+ if r.StatusCode != 200 {
+ t.Log(r)
+ }
+ reqb, _ := httputil.DumpRequest(r.Request, true)
+ if !strings.Contains((string)(reqb), "Testheader: testvalue") {
+ t.Errorf("Default Header is missing")
+ }
+}
+
+func TestHostOverride(t *testing.T) {
+ _, r, err := client.PetApi.FindPetsByStatus(context.Background(), nil)
+
+ if err != nil {
+ t.Fatalf("Error while finding pets by status: %v", err)
+ }
+
+ if r.Request.URL.Host != testHost {
+ t.Errorf("Request Host is %v, expected %v", r.Request.Host, testHost)
+ }
+}
+
+func TestSchemeOverride(t *testing.T) {
+ _, r, err := client.PetApi.FindPetsByStatus(context.Background(), nil)
+
+ if err != nil {
+ t.Fatalf("Error while finding pets by status: %v", err)
+ }
+
+ if r.Request.URL.Scheme != testScheme {
+ t.Errorf("Request Scheme is %v, expected %v", r.Request.URL.Scheme, testScheme)
+ }
+}
+
+// Add custom clients to the context.
+func createContext(httpClient *http.Client) context.Context {
+ parent := oauth2.NoContext
+ ctx := context.WithValue(parent, oauth2.HTTPClient, httpClient)
+ return ctx
+}
diff --git a/samples/client/petstore/go-experimental/fake_api_test.go b/samples/client/petstore/go-experimental/fake_api_test.go
new file mode 100644
index 000000000000..f4242b5048c0
--- /dev/null
+++ b/samples/client/petstore/go-experimental/fake_api_test.go
@@ -0,0 +1,28 @@
+package main
+
+import (
+ "testing"
+
+ sw "./go-petstore"
+ "golang.org/x/net/context"
+)
+
+// TestPutBodyWithFileSchema ensures a model with the name 'File'
+// gets converted properly to the petstore.File struct vs. *os.File
+// as specified in typeMapping for 'File'.
+func TestPutBodyWithFileSchema(t *testing.T) {
+ return // early return to test compilation
+
+ schema := sw.FileSchemaTestClass{
+ File: sw.File{SourceURI: "https://example.com/image.png"},
+ Files: []sw.File{{SourceURI: "https://example.com/image.png"}}}
+
+ r, err := client.FakeApi.TestBodyWithFileSchema(context.Background(), schema)
+
+ if err != nil {
+ t.Fatalf("Error while adding pet: %v", err)
+ }
+ if r.StatusCode != 200 {
+ t.Log(r)
+ }
+}
diff --git a/samples/client/petstore/go-experimental/go-petstore/.gitignore b/samples/client/petstore/go-experimental/go-petstore/.gitignore
new file mode 100644
index 000000000000..daf913b1b347
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/.gitignore
@@ -0,0 +1,24 @@
+# Compiled Object files, Static and Dynamic libs (Shared Objects)
+*.o
+*.a
+*.so
+
+# Folders
+_obj
+_test
+
+# Architecture specific extensions/prefixes
+*.[568vq]
+[568vq].out
+
+*.cgo1.go
+*.cgo2.c
+_cgo_defun.c
+_cgo_gotypes.go
+_cgo_export.*
+
+_testmain.go
+
+*.exe
+*.test
+*.prof
diff --git a/samples/client/petstore/go-experimental/go-petstore/.openapi-generator-ignore b/samples/client/petstore/go-experimental/go-petstore/.openapi-generator-ignore
new file mode 100644
index 000000000000..7484ee590a38
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/.openapi-generator-ignore
@@ -0,0 +1,23 @@
+# OpenAPI Generator Ignore
+# Generated by openapi-generator https://github.com/openapitools/openapi-generator
+
+# Use this file to prevent files from being overwritten by the generator.
+# The patterns follow closely to .gitignore or .dockerignore.
+
+# As an example, the C# client generator defines ApiClient.cs.
+# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
+#ApiClient.cs
+
+# You can match any string of characters against a directory, file or extension with a single asterisk (*):
+#foo/*/qux
+# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
+
+# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
+#foo/**/qux
+# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
+
+# You can also negate patterns with an exclamation (!).
+# For example, you can ignore all files in a docs folder with the file extension .md:
+#docs/*.md
+# Then explicitly reverse the ignore rule for a single file:
+#!docs/README.md
diff --git a/samples/client/petstore/go-experimental/go-petstore/.openapi-generator/VERSION b/samples/client/petstore/go-experimental/go-petstore/.openapi-generator/VERSION
new file mode 100644
index 000000000000..479c313e87b9
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/.openapi-generator/VERSION
@@ -0,0 +1 @@
+4.0.3-SNAPSHOT
\ No newline at end of file
diff --git a/samples/client/petstore/go-experimental/go-petstore/.travis.yml b/samples/client/petstore/go-experimental/go-petstore/.travis.yml
new file mode 100644
index 000000000000..f5cb2ce9a5aa
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/.travis.yml
@@ -0,0 +1,8 @@
+language: go
+
+install:
+ - go get -d -v .
+
+script:
+ - go build -v ./
+
diff --git a/samples/client/petstore/go-experimental/go-petstore/README.md b/samples/client/petstore/go-experimental/go-petstore/README.md
new file mode 100644
index 000000000000..025ee80f2e4a
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/README.md
@@ -0,0 +1,205 @@
+# Go API client for petstore
+
+This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+
+## Overview
+This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client.
+
+- API version: 1.0.0
+- Package version: 1.0.0
+- Build package: org.openapitools.codegen.languages.GoClientExperimentalCodegen
+
+## Installation
+
+Install the following dependencies:
+
+```shell
+go get github.com/stretchr/testify/assert
+go get golang.org/x/oauth2
+go get golang.org/x/net/context
+go get github.com/antihax/optional
+```
+
+Put the package under your project folder and add the following in import:
+
+```golang
+import "./petstore"
+```
+
+## Documentation for API Endpoints
+
+All URIs are relative to *http://petstore.swagger.io:80/v2*
+
+Class | Method | HTTP request | Description
+------------ | ------------- | ------------- | -------------
+*AnotherFakeApi* | [**Call123TestSpecialTags**](docs/AnotherFakeApi.md#call123testspecialtags) | **Patch** /another-fake/dummy | To test special tags
+*FakeApi* | [**CreateXmlItem**](docs/FakeApi.md#createxmlitem) | **Post** /fake/create_xml_item | creates an XmlItem
+*FakeApi* | [**FakeOuterBooleanSerialize**](docs/FakeApi.md#fakeouterbooleanserialize) | **Post** /fake/outer/boolean |
+*FakeApi* | [**FakeOuterCompositeSerialize**](docs/FakeApi.md#fakeoutercompositeserialize) | **Post** /fake/outer/composite |
+*FakeApi* | [**FakeOuterNumberSerialize**](docs/FakeApi.md#fakeouternumberserialize) | **Post** /fake/outer/number |
+*FakeApi* | [**FakeOuterStringSerialize**](docs/FakeApi.md#fakeouterstringserialize) | **Post** /fake/outer/string |
+*FakeApi* | [**TestBodyWithFileSchema**](docs/FakeApi.md#testbodywithfileschema) | **Put** /fake/body-with-file-schema |
+*FakeApi* | [**TestBodyWithQueryParams**](docs/FakeApi.md#testbodywithqueryparams) | **Put** /fake/body-with-query-params |
+*FakeApi* | [**TestClientModel**](docs/FakeApi.md#testclientmodel) | **Patch** /fake | To test \"client\" model
+*FakeApi* | [**TestEndpointParameters**](docs/FakeApi.md#testendpointparameters) | **Post** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
+*FakeApi* | [**TestEnumParameters**](docs/FakeApi.md#testenumparameters) | **Get** /fake | To test enum parameters
+*FakeApi* | [**TestGroupParameters**](docs/FakeApi.md#testgroupparameters) | **Delete** /fake | Fake endpoint to test group parameters (optional)
+*FakeApi* | [**TestInlineAdditionalProperties**](docs/FakeApi.md#testinlineadditionalproperties) | **Post** /fake/inline-additionalProperties | test inline additionalProperties
+*FakeApi* | [**TestJsonFormData**](docs/FakeApi.md#testjsonformdata) | **Get** /fake/jsonFormData | test json serialization of form data
+*FakeClassnameTags123Api* | [**TestClassname**](docs/FakeClassnameTags123Api.md#testclassname) | **Patch** /fake_classname_test | To test class name in snake case
+*PetApi* | [**AddPet**](docs/PetApi.md#addpet) | **Post** /pet | Add a new pet to the store
+*PetApi* | [**DeletePet**](docs/PetApi.md#deletepet) | **Delete** /pet/{petId} | Deletes a pet
+*PetApi* | [**FindPetsByStatus**](docs/PetApi.md#findpetsbystatus) | **Get** /pet/findByStatus | Finds Pets by status
+*PetApi* | [**FindPetsByTags**](docs/PetApi.md#findpetsbytags) | **Get** /pet/findByTags | Finds Pets by tags
+*PetApi* | [**GetPetById**](docs/PetApi.md#getpetbyid) | **Get** /pet/{petId} | Find pet by ID
+*PetApi* | [**UpdatePet**](docs/PetApi.md#updatepet) | **Put** /pet | Update an existing pet
+*PetApi* | [**UpdatePetWithForm**](docs/PetApi.md#updatepetwithform) | **Post** /pet/{petId} | Updates a pet in the store with form data
+*PetApi* | [**UploadFile**](docs/PetApi.md#uploadfile) | **Post** /pet/{petId}/uploadImage | uploads an image
+*PetApi* | [**UploadFileWithRequiredFile**](docs/PetApi.md#uploadfilewithrequiredfile) | **Post** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required)
+*StoreApi* | [**DeleteOrder**](docs/StoreApi.md#deleteorder) | **Delete** /store/order/{order_id} | Delete purchase order by ID
+*StoreApi* | [**GetInventory**](docs/StoreApi.md#getinventory) | **Get** /store/inventory | Returns pet inventories by status
+*StoreApi* | [**GetOrderById**](docs/StoreApi.md#getorderbyid) | **Get** /store/order/{order_id} | Find purchase order by ID
+*StoreApi* | [**PlaceOrder**](docs/StoreApi.md#placeorder) | **Post** /store/order | Place an order for a pet
+*UserApi* | [**CreateUser**](docs/UserApi.md#createuser) | **Post** /user | Create user
+*UserApi* | [**CreateUsersWithArrayInput**](docs/UserApi.md#createuserswitharrayinput) | **Post** /user/createWithArray | Creates list of users with given input array
+*UserApi* | [**CreateUsersWithListInput**](docs/UserApi.md#createuserswithlistinput) | **Post** /user/createWithList | Creates list of users with given input array
+*UserApi* | [**DeleteUser**](docs/UserApi.md#deleteuser) | **Delete** /user/{username} | Delete user
+*UserApi* | [**GetUserByName**](docs/UserApi.md#getuserbyname) | **Get** /user/{username} | Get user by user name
+*UserApi* | [**LoginUser**](docs/UserApi.md#loginuser) | **Get** /user/login | Logs user into the system
+*UserApi* | [**LogoutUser**](docs/UserApi.md#logoutuser) | **Get** /user/logout | Logs out current logged in user session
+*UserApi* | [**UpdateUser**](docs/UserApi.md#updateuser) | **Put** /user/{username} | Updated user
+
+
+## Documentation For Models
+
+ - [AdditionalPropertiesAnyType](docs/AdditionalPropertiesAnyType.md)
+ - [AdditionalPropertiesArray](docs/AdditionalPropertiesArray.md)
+ - [AdditionalPropertiesBoolean](docs/AdditionalPropertiesBoolean.md)
+ - [AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md)
+ - [AdditionalPropertiesInteger](docs/AdditionalPropertiesInteger.md)
+ - [AdditionalPropertiesNumber](docs/AdditionalPropertiesNumber.md)
+ - [AdditionalPropertiesObject](docs/AdditionalPropertiesObject.md)
+ - [AdditionalPropertiesString](docs/AdditionalPropertiesString.md)
+ - [Animal](docs/Animal.md)
+ - [ApiResponse](docs/ApiResponse.md)
+ - [ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md)
+ - [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md)
+ - [ArrayTest](docs/ArrayTest.md)
+ - [Capitalization](docs/Capitalization.md)
+ - [Cat](docs/Cat.md)
+ - [CatAllOf](docs/CatAllOf.md)
+ - [Category](docs/Category.md)
+ - [ClassModel](docs/ClassModel.md)
+ - [Client](docs/Client.md)
+ - [Dog](docs/Dog.md)
+ - [DogAllOf](docs/DogAllOf.md)
+ - [EnumArrays](docs/EnumArrays.md)
+ - [EnumClass](docs/EnumClass.md)
+ - [EnumTest](docs/EnumTest.md)
+ - [File](docs/File.md)
+ - [FileSchemaTestClass](docs/FileSchemaTestClass.md)
+ - [FormatTest](docs/FormatTest.md)
+ - [HasOnlyReadOnly](docs/HasOnlyReadOnly.md)
+ - [List](docs/List.md)
+ - [MapTest](docs/MapTest.md)
+ - [MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md)
+ - [Model200Response](docs/Model200Response.md)
+ - [Name](docs/Name.md)
+ - [NumberOnly](docs/NumberOnly.md)
+ - [Order](docs/Order.md)
+ - [OuterComposite](docs/OuterComposite.md)
+ - [OuterEnum](docs/OuterEnum.md)
+ - [Pet](docs/Pet.md)
+ - [ReadOnlyFirst](docs/ReadOnlyFirst.md)
+ - [Return](docs/Return.md)
+ - [SpecialModelName](docs/SpecialModelName.md)
+ - [Tag](docs/Tag.md)
+ - [TypeHolderDefault](docs/TypeHolderDefault.md)
+ - [TypeHolderExample](docs/TypeHolderExample.md)
+ - [User](docs/User.md)
+ - [XmlItem](docs/XmlItem.md)
+
+
+## Documentation For Authorization
+
+
+
+## api_key
+
+- **Type**: API key
+
+Example
+
+```golang
+auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{
+ Key: "APIKEY",
+ Prefix: "Bearer", // Omit if not necessary.
+})
+r, err := client.Service.Operation(auth, args)
+```
+
+
+## api_key_query
+
+- **Type**: API key
+
+Example
+
+```golang
+auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{
+ Key: "APIKEY",
+ Prefix: "Bearer", // Omit if not necessary.
+})
+r, err := client.Service.Operation(auth, args)
+```
+
+
+## http_basic_test
+
+- **Type**: HTTP basic authentication
+
+Example
+
+```golang
+auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{
+ UserName: "username",
+ Password: "password",
+})
+r, err := client.Service.Operation(auth, args)
+```
+
+
+## petstore_auth
+
+
+- **Type**: OAuth
+- **Flow**: implicit
+- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog
+- **Scopes**:
+ - **write:pets**: modify pets in your account
+ - **read:pets**: read your pets
+
+Example
+
+```golang
+auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING")
+r, err := client.Service.Operation(auth, args)
+```
+
+Or via OAuth2 module to automatically refresh tokens and perform user authentication.
+
+```golang
+import "golang.org/x/oauth2"
+
+/* Perform OAuth2 round trip request and obtain a token */
+
+tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token)
+auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource)
+r, err := client.Service.Operation(auth, args)
+```
+
+
+## Author
+
+
+
diff --git a/samples/client/petstore/go-experimental/go-petstore/api/openapi.yaml b/samples/client/petstore/go-experimental/go-petstore/api/openapi.yaml
new file mode 100644
index 000000000000..5a020a1d0ab8
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/api/openapi.yaml
@@ -0,0 +1,2046 @@
+openapi: 3.0.1
+info:
+ description: 'This spec is mainly for testing Petstore server and contains fake
+ endpoints, models. Please do not use this for any other purpose. Special characters:
+ " \'
+ license:
+ name: Apache-2.0
+ url: http://www.apache.org/licenses/LICENSE-2.0.html
+ title: OpenAPI Petstore
+ version: 1.0.0
+servers:
+- url: http://petstore.swagger.io:80/v2
+tags:
+- description: Everything about your Pets
+ name: pet
+- description: Access to Petstore orders
+ name: store
+- description: Operations about user
+ name: user
+paths:
+ /pet:
+ post:
+ operationId: addPet
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ description: Pet object that needs to be added to the store
+ required: true
+ responses:
+ 200:
+ content: {}
+ description: successful operation
+ 405:
+ content: {}
+ description: Invalid input
+ security:
+ - petstore_auth:
+ - write:pets
+ - read:pets
+ summary: Add a new pet to the store
+ tags:
+ - pet
+ x-codegen-request-body-name: body
+ put:
+ operationId: updatePet
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ description: Pet object that needs to be added to the store
+ required: true
+ responses:
+ 200:
+ content: {}
+ description: successful operation
+ 400:
+ content: {}
+ description: Invalid ID supplied
+ 404:
+ content: {}
+ description: Pet not found
+ 405:
+ content: {}
+ description: Validation exception
+ security:
+ - petstore_auth:
+ - write:pets
+ - read:pets
+ summary: Update an existing pet
+ tags:
+ - pet
+ x-codegen-request-body-name: body
+ /pet/findByStatus:
+ get:
+ description: Multiple status values can be provided with comma separated strings
+ operationId: findPetsByStatus
+ parameters:
+ - description: Status values that need to be considered for filter
+ explode: false
+ in: query
+ name: status
+ required: true
+ schema:
+ items:
+ default: available
+ enum:
+ - available
+ - pending
+ - sold
+ type: string
+ type: array
+ style: form
+ responses:
+ 200:
+ content:
+ application/xml:
+ schema:
+ items:
+ $ref: '#/components/schemas/Pet'
+ type: array
+ application/json:
+ schema:
+ items:
+ $ref: '#/components/schemas/Pet'
+ type: array
+ description: successful operation
+ 400:
+ content: {}
+ description: Invalid status value
+ security:
+ - petstore_auth:
+ - write:pets
+ - read:pets
+ summary: Finds Pets by status
+ tags:
+ - pet
+ /pet/findByTags:
+ get:
+ deprecated: true
+ description: Multiple tags can be provided with comma separated strings. Use
+ tag1, tag2, tag3 for testing.
+ operationId: findPetsByTags
+ parameters:
+ - description: Tags to filter by
+ explode: false
+ in: query
+ name: tags
+ required: true
+ schema:
+ items:
+ type: string
+ type: array
+ style: form
+ responses:
+ 200:
+ content:
+ application/xml:
+ schema:
+ items:
+ $ref: '#/components/schemas/Pet'
+ type: array
+ application/json:
+ schema:
+ items:
+ $ref: '#/components/schemas/Pet'
+ type: array
+ description: successful operation
+ 400:
+ content: {}
+ description: Invalid tag value
+ security:
+ - petstore_auth:
+ - write:pets
+ - read:pets
+ summary: Finds Pets by tags
+ tags:
+ - pet
+ /pet/{petId}:
+ delete:
+ operationId: deletePet
+ parameters:
+ - in: header
+ name: api_key
+ schema:
+ type: string
+ - description: Pet id to delete
+ in: path
+ name: petId
+ required: true
+ schema:
+ format: int64
+ type: integer
+ responses:
+ 200:
+ content: {}
+ description: successful operation
+ 400:
+ content: {}
+ description: Invalid pet value
+ security:
+ - petstore_auth:
+ - write:pets
+ - read:pets
+ summary: Deletes a pet
+ tags:
+ - pet
+ get:
+ description: Returns a single pet
+ operationId: getPetById
+ parameters:
+ - description: ID of pet to return
+ in: path
+ name: petId
+ required: true
+ schema:
+ format: int64
+ type: integer
+ responses:
+ 200:
+ content:
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ description: successful operation
+ 400:
+ content: {}
+ description: Invalid ID supplied
+ 404:
+ content: {}
+ description: Pet not found
+ security:
+ - api_key: []
+ summary: Find pet by ID
+ tags:
+ - pet
+ post:
+ operationId: updatePetWithForm
+ parameters:
+ - description: ID of pet that needs to be updated
+ in: path
+ name: petId
+ required: true
+ schema:
+ format: int64
+ type: integer
+ requestBody:
+ content:
+ application/x-www-form-urlencoded:
+ schema:
+ properties:
+ name:
+ description: Updated name of the pet
+ type: string
+ status:
+ description: Updated status of the pet
+ type: string
+ responses:
+ 405:
+ content: {}
+ description: Invalid input
+ security:
+ - petstore_auth:
+ - write:pets
+ - read:pets
+ summary: Updates a pet in the store with form data
+ tags:
+ - pet
+ /pet/{petId}/uploadImage:
+ post:
+ operationId: uploadFile
+ parameters:
+ - description: ID of pet to update
+ in: path
+ name: petId
+ required: true
+ schema:
+ format: int64
+ type: integer
+ requestBody:
+ content:
+ multipart/form-data:
+ schema:
+ properties:
+ additionalMetadata:
+ description: Additional data to pass to server
+ type: string
+ file:
+ description: file to upload
+ format: binary
+ type: string
+ responses:
+ 200:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ description: successful operation
+ security:
+ - petstore_auth:
+ - write:pets
+ - read:pets
+ summary: uploads an image
+ tags:
+ - pet
+ /store/inventory:
+ get:
+ description: Returns a map of status codes to quantities
+ operationId: getInventory
+ responses:
+ 200:
+ content:
+ application/json:
+ schema:
+ additionalProperties:
+ format: int32
+ type: integer
+ type: object
+ description: successful operation
+ security:
+ - api_key: []
+ summary: Returns pet inventories by status
+ tags:
+ - store
+ /store/order:
+ post:
+ operationId: placeOrder
+ requestBody:
+ content:
+ '*/*':
+ schema:
+ $ref: '#/components/schemas/Order'
+ description: order placed for purchasing the pet
+ required: true
+ responses:
+ 200:
+ content:
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Order'
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Order'
+ description: successful operation
+ 400:
+ content: {}
+ description: Invalid Order
+ summary: Place an order for a pet
+ tags:
+ - store
+ x-codegen-request-body-name: body
+ /store/order/{order_id}:
+ delete:
+ description: For valid response try integer IDs with value < 1000. Anything
+ above 1000 or nonintegers will generate API errors
+ operationId: deleteOrder
+ parameters:
+ - description: ID of the order that needs to be deleted
+ in: path
+ name: order_id
+ required: true
+ schema:
+ type: string
+ responses:
+ 400:
+ content: {}
+ description: Invalid ID supplied
+ 404:
+ content: {}
+ description: Order not found
+ summary: Delete purchase order by ID
+ tags:
+ - store
+ get:
+ description: For valid response try integer IDs with value <= 5 or > 10. Other
+ values will generated exceptions
+ operationId: getOrderById
+ parameters:
+ - description: ID of pet that needs to be fetched
+ in: path
+ name: order_id
+ required: true
+ schema:
+ format: int64
+ maximum: 5
+ minimum: 1
+ type: integer
+ responses:
+ 200:
+ content:
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Order'
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Order'
+ description: successful operation
+ 400:
+ content: {}
+ description: Invalid ID supplied
+ 404:
+ content: {}
+ description: Order not found
+ summary: Find purchase order by ID
+ tags:
+ - store
+ /user:
+ post:
+ description: This can only be done by the logged in user.
+ operationId: createUser
+ requestBody:
+ content:
+ '*/*':
+ schema:
+ $ref: '#/components/schemas/User'
+ description: Created user object
+ required: true
+ responses:
+ default:
+ content: {}
+ description: successful operation
+ summary: Create user
+ tags:
+ - user
+ x-codegen-request-body-name: body
+ /user/createWithArray:
+ post:
+ operationId: createUsersWithArrayInput
+ requestBody:
+ content:
+ '*/*':
+ schema:
+ items:
+ $ref: '#/components/schemas/User'
+ type: array
+ description: List of user object
+ required: true
+ responses:
+ default:
+ content: {}
+ description: successful operation
+ summary: Creates list of users with given input array
+ tags:
+ - user
+ x-codegen-request-body-name: body
+ /user/createWithList:
+ post:
+ operationId: createUsersWithListInput
+ requestBody:
+ content:
+ '*/*':
+ schema:
+ items:
+ $ref: '#/components/schemas/User'
+ type: array
+ description: List of user object
+ required: true
+ responses:
+ default:
+ content: {}
+ description: successful operation
+ summary: Creates list of users with given input array
+ tags:
+ - user
+ x-codegen-request-body-name: body
+ /user/login:
+ get:
+ operationId: loginUser
+ parameters:
+ - description: The user name for login
+ in: query
+ name: username
+ required: true
+ schema:
+ type: string
+ - description: The password for login in clear text
+ in: query
+ name: password
+ required: true
+ schema:
+ type: string
+ responses:
+ 200:
+ content:
+ application/xml:
+ schema:
+ type: string
+ application/json:
+ schema:
+ type: string
+ description: successful operation
+ headers:
+ X-Rate-Limit:
+ description: calls per hour allowed by the user
+ schema:
+ format: int32
+ type: integer
+ X-Expires-After:
+ description: date in UTC when token expires
+ schema:
+ format: date-time
+ type: string
+ 400:
+ content: {}
+ description: Invalid username/password supplied
+ summary: Logs user into the system
+ tags:
+ - user
+ /user/logout:
+ get:
+ operationId: logoutUser
+ responses:
+ default:
+ content: {}
+ description: successful operation
+ summary: Logs out current logged in user session
+ tags:
+ - user
+ /user/{username}:
+ delete:
+ description: This can only be done by the logged in user.
+ operationId: deleteUser
+ parameters:
+ - description: The name that needs to be deleted
+ in: path
+ name: username
+ required: true
+ schema:
+ type: string
+ responses:
+ 400:
+ content: {}
+ description: Invalid username supplied
+ 404:
+ content: {}
+ description: User not found
+ summary: Delete user
+ tags:
+ - user
+ get:
+ operationId: getUserByName
+ parameters:
+ - description: The name that needs to be fetched. Use user1 for testing.
+ in: path
+ name: username
+ required: true
+ schema:
+ type: string
+ responses:
+ 200:
+ content:
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/User'
+ application/json:
+ schema:
+ $ref: '#/components/schemas/User'
+ description: successful operation
+ 400:
+ content: {}
+ description: Invalid username supplied
+ 404:
+ content: {}
+ description: User not found
+ summary: Get user by user name
+ tags:
+ - user
+ put:
+ description: This can only be done by the logged in user.
+ operationId: updateUser
+ parameters:
+ - description: name that need to be deleted
+ in: path
+ name: username
+ required: true
+ schema:
+ type: string
+ requestBody:
+ content:
+ '*/*':
+ schema:
+ $ref: '#/components/schemas/User'
+ description: Updated user object
+ required: true
+ responses:
+ 400:
+ content: {}
+ description: Invalid user supplied
+ 404:
+ content: {}
+ description: User not found
+ summary: Updated user
+ tags:
+ - user
+ x-codegen-request-body-name: body
+ /fake_classname_test:
+ patch:
+ description: To test class name in snake case
+ operationId: testClassname
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Client'
+ description: client model
+ required: true
+ responses:
+ 200:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Client'
+ description: successful operation
+ security:
+ - api_key_query: []
+ summary: To test class name in snake case
+ tags:
+ - fake_classname_tags 123#$%^
+ x-codegen-request-body-name: body
+ /fake:
+ delete:
+ description: Fake endpoint to test group parameters (optional)
+ operationId: testGroupParameters
+ parameters:
+ - description: Required String in group parameters
+ in: query
+ name: required_string_group
+ required: true
+ schema:
+ type: integer
+ - description: Required Boolean in group parameters
+ in: header
+ name: required_boolean_group
+ required: true
+ schema:
+ type: boolean
+ - description: Required Integer in group parameters
+ in: query
+ name: required_int64_group
+ required: true
+ schema:
+ format: int64
+ type: integer
+ - description: String in group parameters
+ in: query
+ name: string_group
+ schema:
+ type: integer
+ - description: Boolean in group parameters
+ in: header
+ name: boolean_group
+ schema:
+ type: boolean
+ - description: Integer in group parameters
+ in: query
+ name: int64_group
+ schema:
+ format: int64
+ type: integer
+ responses:
+ 400:
+ content: {}
+ description: Someting wrong
+ summary: Fake endpoint to test group parameters (optional)
+ tags:
+ - fake
+ x-group-parameters: true
+ get:
+ description: To test enum parameters
+ operationId: testEnumParameters
+ parameters:
+ - description: Header parameter enum test (string array)
+ explode: false
+ in: header
+ name: enum_header_string_array
+ schema:
+ items:
+ default: $
+ enum:
+ - '>'
+ - $
+ type: string
+ type: array
+ style: simple
+ - description: Header parameter enum test (string)
+ in: header
+ name: enum_header_string
+ schema:
+ default: -efg
+ enum:
+ - _abc
+ - -efg
+ - (xyz)
+ type: string
+ - description: Query parameter enum test (string array)
+ explode: false
+ in: query
+ name: enum_query_string_array
+ schema:
+ items:
+ default: $
+ enum:
+ - '>'
+ - $
+ type: string
+ type: array
+ style: form
+ - description: Query parameter enum test (string)
+ in: query
+ name: enum_query_string
+ schema:
+ default: -efg
+ enum:
+ - _abc
+ - -efg
+ - (xyz)
+ type: string
+ - description: Query parameter enum test (double)
+ in: query
+ name: enum_query_integer
+ schema:
+ enum:
+ - 1
+ - -2
+ format: int32
+ type: integer
+ - description: Query parameter enum test (double)
+ in: query
+ name: enum_query_double
+ schema:
+ enum:
+ - 1.1
+ - -1.2
+ format: double
+ type: number
+ requestBody:
+ content:
+ application/x-www-form-urlencoded:
+ schema:
+ properties:
+ enum_form_string_array:
+ description: Form parameter enum test (string array)
+ items:
+ default: $
+ enum:
+ - '>'
+ - $
+ type: string
+ type: array
+ enum_form_string:
+ default: -efg
+ description: Form parameter enum test (string)
+ enum:
+ - _abc
+ - -efg
+ - (xyz)
+ type: string
+ responses:
+ 400:
+ content: {}
+ description: Invalid request
+ 404:
+ content: {}
+ description: Not found
+ summary: To test enum parameters
+ tags:
+ - fake
+ patch:
+ description: To test "client" model
+ operationId: testClientModel
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Client'
+ description: client model
+ required: true
+ responses:
+ 200:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Client'
+ description: successful operation
+ summary: To test "client" model
+ tags:
+ - fake
+ x-codegen-request-body-name: body
+ post:
+ description: |
+ Fake endpoint for testing various parameters
+ 假端點
+ 偽のエンドポイント
+ 가짜 엔드 포인트
+ operationId: testEndpointParameters
+ requestBody:
+ content:
+ application/x-www-form-urlencoded:
+ schema:
+ properties:
+ integer:
+ description: None
+ maximum: 100
+ minimum: 10
+ type: integer
+ int32:
+ description: None
+ format: int32
+ maximum: 200
+ minimum: 20
+ type: integer
+ int64:
+ description: None
+ format: int64
+ type: integer
+ number:
+ description: None
+ maximum: 543.2
+ minimum: 32.1
+ type: number
+ float:
+ description: None
+ format: float
+ maximum: 987.6
+ type: number
+ double:
+ description: None
+ format: double
+ maximum: 123.4
+ minimum: 67.8
+ type: number
+ string:
+ description: None
+ pattern: /[a-z]/i
+ type: string
+ pattern_without_delimiter:
+ description: None
+ pattern: ^[A-Z].*
+ type: string
+ byte:
+ description: None
+ format: byte
+ type: string
+ binary:
+ description: None
+ format: binary
+ type: string
+ date:
+ description: None
+ format: date
+ type: string
+ dateTime:
+ description: None
+ format: date-time
+ type: string
+ password:
+ description: None
+ format: password
+ maxLength: 64
+ minLength: 10
+ type: string
+ callback:
+ description: None
+ type: string
+ required:
+ - byte
+ - double
+ - number
+ - pattern_without_delimiter
+ required: true
+ responses:
+ 400:
+ content: {}
+ description: Invalid username supplied
+ 404:
+ content: {}
+ description: User not found
+ security:
+ - http_basic_test: []
+ summary: |
+ Fake endpoint for testing various parameters
+ 假端點
+ 偽のエンドポイント
+ 가짜 엔드 포인트
+ tags:
+ - fake
+ /fake/outer/number:
+ post:
+ description: Test serialization of outer number types
+ operationId: fakeOuterNumberSerialize
+ requestBody:
+ content:
+ '*/*':
+ schema:
+ $ref: '#/components/schemas/OuterNumber'
+ description: Input number as post body
+ required: false
+ responses:
+ 200:
+ content:
+ '*/*':
+ schema:
+ $ref: '#/components/schemas/OuterNumber'
+ description: Output number
+ tags:
+ - fake
+ x-codegen-request-body-name: body
+ /fake/outer/string:
+ post:
+ description: Test serialization of outer string types
+ operationId: fakeOuterStringSerialize
+ requestBody:
+ content:
+ '*/*':
+ schema:
+ $ref: '#/components/schemas/OuterString'
+ description: Input string as post body
+ required: false
+ responses:
+ 200:
+ content:
+ '*/*':
+ schema:
+ $ref: '#/components/schemas/OuterString'
+ description: Output string
+ tags:
+ - fake
+ x-codegen-request-body-name: body
+ /fake/outer/boolean:
+ post:
+ description: Test serialization of outer boolean types
+ operationId: fakeOuterBooleanSerialize
+ requestBody:
+ content:
+ '*/*':
+ schema:
+ $ref: '#/components/schemas/OuterBoolean'
+ description: Input boolean as post body
+ required: false
+ responses:
+ 200:
+ content:
+ '*/*':
+ schema:
+ $ref: '#/components/schemas/OuterBoolean'
+ description: Output boolean
+ tags:
+ - fake
+ x-codegen-request-body-name: body
+ /fake/outer/composite:
+ post:
+ description: Test serialization of object with outer number type
+ operationId: fakeOuterCompositeSerialize
+ requestBody:
+ content:
+ '*/*':
+ schema:
+ $ref: '#/components/schemas/OuterComposite'
+ description: Input composite as post body
+ required: false
+ responses:
+ 200:
+ content:
+ '*/*':
+ schema:
+ $ref: '#/components/schemas/OuterComposite'
+ description: Output composite
+ tags:
+ - fake
+ x-codegen-request-body-name: body
+ /fake/jsonFormData:
+ get:
+ operationId: testJsonFormData
+ requestBody:
+ content:
+ application/x-www-form-urlencoded:
+ schema:
+ properties:
+ param:
+ description: field1
+ type: string
+ param2:
+ description: field2
+ type: string
+ required:
+ - param
+ - param2
+ required: true
+ responses:
+ 200:
+ content: {}
+ description: successful operation
+ summary: test json serialization of form data
+ tags:
+ - fake
+ /fake/inline-additionalProperties:
+ post:
+ operationId: testInlineAdditionalProperties
+ requestBody:
+ content:
+ application/json:
+ schema:
+ additionalProperties:
+ type: string
+ type: object
+ description: request body
+ required: true
+ responses:
+ 200:
+ content: {}
+ description: successful operation
+ summary: test inline additionalProperties
+ tags:
+ - fake
+ x-codegen-request-body-name: param
+ /fake/body-with-query-params:
+ put:
+ operationId: testBodyWithQueryParams
+ parameters:
+ - in: query
+ name: query
+ required: true
+ schema:
+ type: string
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/User'
+ required: true
+ responses:
+ 200:
+ content: {}
+ description: Success
+ tags:
+ - fake
+ x-codegen-request-body-name: body
+ /fake/create_xml_item:
+ post:
+ description: this route creates an XmlItem
+ operationId: createXmlItem
+ requestBody:
+ content:
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/XmlItem'
+ application/xml; charset=utf-8:
+ schema:
+ $ref: '#/components/schemas/XmlItem'
+ application/xml; charset=utf-16:
+ schema:
+ $ref: '#/components/schemas/XmlItem'
+ text/xml:
+ schema:
+ $ref: '#/components/schemas/XmlItem'
+ text/xml; charset=utf-8:
+ schema:
+ $ref: '#/components/schemas/XmlItem'
+ text/xml; charset=utf-16:
+ schema:
+ $ref: '#/components/schemas/XmlItem'
+ description: XmlItem Body
+ required: true
+ responses:
+ 200:
+ content: {}
+ description: successful operation
+ summary: creates an XmlItem
+ tags:
+ - fake
+ x-codegen-request-body-name: XmlItem
+ /another-fake/dummy:
+ patch:
+ description: To test special tags and operation ID starting with number
+ operationId: 123_test_@#$%_special_tags
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Client'
+ description: client model
+ required: true
+ responses:
+ 200:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Client'
+ description: successful operation
+ summary: To test special tags
+ tags:
+ - $another-fake?
+ x-codegen-request-body-name: body
+ /fake/body-with-file-schema:
+ put:
+ description: For this test, the body for this request much reference a schema
+ named `File`.
+ operationId: testBodyWithFileSchema
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/FileSchemaTestClass'
+ required: true
+ responses:
+ 200:
+ content: {}
+ description: Success
+ tags:
+ - fake
+ x-codegen-request-body-name: body
+ /fake/{petId}/uploadImageWithRequiredFile:
+ post:
+ operationId: uploadFileWithRequiredFile
+ parameters:
+ - description: ID of pet to update
+ in: path
+ name: petId
+ required: true
+ schema:
+ format: int64
+ type: integer
+ requestBody:
+ content:
+ multipart/form-data:
+ schema:
+ properties:
+ additionalMetadata:
+ description: Additional data to pass to server
+ type: string
+ requiredFile:
+ description: file to upload
+ format: binary
+ type: string
+ required:
+ - requiredFile
+ required: true
+ responses:
+ 200:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ description: successful operation
+ security:
+ - petstore_auth:
+ - write:pets
+ - read:pets
+ summary: uploads an image (required)
+ tags:
+ - pet
+components:
+ schemas:
+ Order:
+ example:
+ petId: 6
+ quantity: 1
+ id: 0
+ shipDate: 2000-01-23T04:56:07.000+00:00
+ complete: false
+ status: placed
+ properties:
+ id:
+ format: int64
+ type: integer
+ petId:
+ format: int64
+ type: integer
+ quantity:
+ format: int32
+ type: integer
+ shipDate:
+ format: date-time
+ type: string
+ status:
+ description: Order Status
+ enum:
+ - placed
+ - approved
+ - delivered
+ type: string
+ complete:
+ default: false
+ type: boolean
+ type: object
+ xml:
+ name: Order
+ Category:
+ example:
+ name: default-name
+ id: 6
+ properties:
+ id:
+ format: int64
+ type: integer
+ name:
+ default: default-name
+ type: string
+ required:
+ - name
+ type: object
+ xml:
+ name: Category
+ User:
+ example:
+ firstName: firstName
+ lastName: lastName
+ password: password
+ userStatus: 6
+ phone: phone
+ id: 0
+ email: email
+ username: username
+ properties:
+ id:
+ format: int64
+ type: integer
+ x-is-unique: true
+ username:
+ type: string
+ firstName:
+ type: string
+ lastName:
+ type: string
+ email:
+ type: string
+ password:
+ type: string
+ phone:
+ type: string
+ userStatus:
+ description: User Status
+ format: int32
+ type: integer
+ type: object
+ xml:
+ name: User
+ Tag:
+ example:
+ name: name
+ id: 1
+ properties:
+ id:
+ format: int64
+ type: integer
+ name:
+ type: string
+ type: object
+ xml:
+ name: Tag
+ Pet:
+ example:
+ photoUrls:
+ - photoUrls
+ - photoUrls
+ name: doggie
+ id: 0
+ category:
+ name: default-name
+ id: 6
+ tags:
+ - name: name
+ id: 1
+ - name: name
+ id: 1
+ status: available
+ properties:
+ id:
+ format: int64
+ type: integer
+ x-is-unique: true
+ category:
+ $ref: '#/components/schemas/Category'
+ name:
+ example: doggie
+ type: string
+ photoUrls:
+ items:
+ type: string
+ type: array
+ xml:
+ name: photoUrl
+ wrapped: true
+ tags:
+ items:
+ $ref: '#/components/schemas/Tag'
+ type: array
+ xml:
+ name: tag
+ wrapped: true
+ status:
+ description: pet status in the store
+ enum:
+ - available
+ - pending
+ - sold
+ type: string
+ required:
+ - name
+ - photoUrls
+ type: object
+ xml:
+ name: Pet
+ ApiResponse:
+ example:
+ code: 0
+ type: type
+ message: message
+ properties:
+ code:
+ format: int32
+ type: integer
+ type:
+ type: string
+ message:
+ type: string
+ type: object
+ $special[model.name]:
+ properties:
+ $special[property.name]:
+ format: int64
+ type: integer
+ type: object
+ xml:
+ name: $special[model.name]
+ Return:
+ description: Model for testing reserved words
+ properties:
+ return:
+ format: int32
+ type: integer
+ type: object
+ xml:
+ name: Return
+ Name:
+ description: Model for testing model name same as property name
+ properties:
+ name:
+ format: int32
+ type: integer
+ snake_case:
+ format: int32
+ readOnly: true
+ type: integer
+ property:
+ type: string
+ 123Number:
+ readOnly: true
+ type: integer
+ required:
+ - name
+ type: object
+ xml:
+ name: Name
+ 200_response:
+ description: Model for testing model name starting with number
+ properties:
+ name:
+ format: int32
+ type: integer
+ class:
+ type: string
+ type: object
+ xml:
+ name: Name
+ ClassModel:
+ description: Model for testing model with "_class" property
+ properties:
+ _class:
+ type: string
+ type: object
+ Dog:
+ allOf:
+ - $ref: '#/components/schemas/Animal'
+ - $ref: '#/components/schemas/Dog_allOf'
+ Cat:
+ allOf:
+ - $ref: '#/components/schemas/Animal'
+ - $ref: '#/components/schemas/Cat_allOf'
+ Animal:
+ discriminator:
+ propertyName: className
+ properties:
+ className:
+ type: string
+ color:
+ default: red
+ type: string
+ required:
+ - className
+ type: object
+ AnimalFarm:
+ items:
+ $ref: '#/components/schemas/Animal'
+ type: array
+ format_test:
+ properties:
+ integer:
+ maximum: 1E+2
+ minimum: 1E+1
+ type: integer
+ int32:
+ format: int32
+ maximum: 2E+2
+ minimum: 2E+1
+ type: integer
+ int64:
+ format: int64
+ type: integer
+ number:
+ maximum: 543.2
+ minimum: 32.1
+ type: number
+ float:
+ format: float
+ maximum: 987.6
+ minimum: 54.3
+ type: number
+ double:
+ format: double
+ maximum: 123.4
+ minimum: 67.8
+ type: number
+ string:
+ pattern: /[a-z]/i
+ type: string
+ byte:
+ format: byte
+ pattern: ^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$
+ type: string
+ binary:
+ format: binary
+ type: string
+ date:
+ format: date
+ type: string
+ dateTime:
+ format: date-time
+ type: string
+ uuid:
+ example: 72f98069-206d-4f12-9f12-3d1e525a8e84
+ format: uuid
+ type: string
+ password:
+ format: password
+ maxLength: 64
+ minLength: 10
+ type: string
+ required:
+ - byte
+ - date
+ - number
+ - password
+ type: object
+ EnumClass:
+ default: -efg
+ enum:
+ - _abc
+ - -efg
+ - (xyz)
+ type: string
+ Enum_Test:
+ properties:
+ enum_string:
+ enum:
+ - UPPER
+ - lower
+ - ""
+ type: string
+ enum_string_required:
+ enum:
+ - UPPER
+ - lower
+ - ""
+ type: string
+ enum_integer:
+ enum:
+ - 1
+ - -1
+ format: int32
+ type: integer
+ enum_number:
+ enum:
+ - 1.1
+ - -1.2
+ format: double
+ type: number
+ outerEnum:
+ $ref: '#/components/schemas/OuterEnum'
+ required:
+ - enum_string_required
+ type: object
+ AdditionalPropertiesClass:
+ properties:
+ map_string:
+ additionalProperties:
+ type: string
+ type: object
+ map_number:
+ additionalProperties:
+ type: number
+ type: object
+ map_integer:
+ additionalProperties:
+ type: integer
+ type: object
+ map_boolean:
+ additionalProperties:
+ type: boolean
+ type: object
+ map_array_integer:
+ additionalProperties:
+ items:
+ type: integer
+ type: array
+ type: object
+ map_array_anytype:
+ additionalProperties:
+ items:
+ properties: {}
+ type: object
+ type: array
+ type: object
+ map_map_string:
+ additionalProperties:
+ additionalProperties:
+ type: string
+ type: object
+ type: object
+ map_map_anytype:
+ additionalProperties:
+ additionalProperties:
+ properties: {}
+ type: object
+ type: object
+ type: object
+ anytype_1:
+ properties: {}
+ type: object
+ anytype_2:
+ type: object
+ anytype_3:
+ properties: {}
+ type: object
+ type: object
+ AdditionalPropertiesString:
+ additionalProperties:
+ type: string
+ properties:
+ name:
+ type: string
+ type: object
+ AdditionalPropertiesInteger:
+ additionalProperties:
+ type: integer
+ properties:
+ name:
+ type: string
+ type: object
+ AdditionalPropertiesNumber:
+ additionalProperties:
+ type: number
+ properties:
+ name:
+ type: string
+ type: object
+ AdditionalPropertiesBoolean:
+ additionalProperties:
+ type: boolean
+ properties:
+ name:
+ type: string
+ type: object
+ AdditionalPropertiesArray:
+ additionalProperties:
+ items:
+ properties: {}
+ type: object
+ type: array
+ properties:
+ name:
+ type: string
+ type: object
+ AdditionalPropertiesObject:
+ additionalProperties:
+ additionalProperties:
+ properties: {}
+ type: object
+ type: object
+ properties:
+ name:
+ type: string
+ type: object
+ AdditionalPropertiesAnyType:
+ additionalProperties:
+ properties: {}
+ type: object
+ properties:
+ name:
+ type: string
+ type: object
+ MixedPropertiesAndAdditionalPropertiesClass:
+ properties:
+ uuid:
+ format: uuid
+ type: string
+ dateTime:
+ format: date-time
+ type: string
+ map:
+ additionalProperties:
+ $ref: '#/components/schemas/Animal'
+ type: object
+ type: object
+ List:
+ properties:
+ 123-list:
+ type: string
+ type: object
+ Client:
+ example:
+ client: client
+ properties:
+ client:
+ type: string
+ type: object
+ ReadOnlyFirst:
+ properties:
+ bar:
+ readOnly: true
+ type: string
+ baz:
+ type: string
+ type: object
+ hasOnlyReadOnly:
+ properties:
+ bar:
+ readOnly: true
+ type: string
+ foo:
+ readOnly: true
+ type: string
+ type: object
+ Capitalization:
+ properties:
+ smallCamel:
+ type: string
+ CapitalCamel:
+ type: string
+ small_Snake:
+ type: string
+ Capital_Snake:
+ type: string
+ SCA_ETH_Flow_Points:
+ type: string
+ ATT_NAME:
+ description: |
+ Name of the pet
+ type: string
+ type: object
+ MapTest:
+ properties:
+ map_map_of_string:
+ additionalProperties:
+ additionalProperties:
+ type: string
+ type: object
+ type: object
+ map_of_enum_string:
+ additionalProperties:
+ enum:
+ - UPPER
+ - lower
+ type: string
+ type: object
+ direct_map:
+ additionalProperties:
+ type: boolean
+ type: object
+ indirect_map:
+ additionalProperties:
+ type: boolean
+ type: object
+ type: object
+ ArrayTest:
+ properties:
+ array_of_string:
+ items:
+ type: string
+ type: array
+ array_array_of_integer:
+ items:
+ items:
+ format: int64
+ type: integer
+ type: array
+ type: array
+ array_array_of_model:
+ items:
+ items:
+ $ref: '#/components/schemas/ReadOnlyFirst'
+ type: array
+ type: array
+ type: object
+ NumberOnly:
+ properties:
+ JustNumber:
+ type: number
+ type: object
+ ArrayOfNumberOnly:
+ properties:
+ ArrayNumber:
+ items:
+ type: number
+ type: array
+ type: object
+ ArrayOfArrayOfNumberOnly:
+ properties:
+ ArrayArrayNumber:
+ items:
+ items:
+ type: number
+ type: array
+ type: array
+ type: object
+ EnumArrays:
+ properties:
+ just_symbol:
+ enum:
+ - '>='
+ - $
+ type: string
+ array_enum:
+ items:
+ enum:
+ - fish
+ - crab
+ type: string
+ type: array
+ type: object
+ OuterEnum:
+ enum:
+ - placed
+ - approved
+ - delivered
+ type: string
+ OuterComposite:
+ example:
+ my_string: my_string
+ my_number: 0.8008281904610115
+ my_boolean: true
+ properties:
+ my_number:
+ type: number
+ my_string:
+ type: string
+ my_boolean:
+ type: boolean
+ x-codegen-body-parameter-name: boolean_post_body
+ type: object
+ OuterNumber:
+ type: number
+ OuterString:
+ type: string
+ OuterBoolean:
+ type: boolean
+ x-codegen-body-parameter-name: boolean_post_body
+ StringBooleanMap:
+ additionalProperties:
+ type: boolean
+ type: object
+ FileSchemaTestClass:
+ example:
+ file:
+ sourceURI: sourceURI
+ files:
+ - sourceURI: sourceURI
+ - sourceURI: sourceURI
+ properties:
+ file:
+ $ref: '#/components/schemas/File'
+ files:
+ items:
+ $ref: '#/components/schemas/File'
+ type: array
+ type: object
+ File:
+ description: Must be named `File` for test.
+ example:
+ sourceURI: sourceURI
+ properties:
+ sourceURI:
+ description: Test capitalization
+ type: string
+ type: object
+ TypeHolderDefault:
+ properties:
+ string_item:
+ default: what
+ type: string
+ number_item:
+ type: number
+ integer_item:
+ type: integer
+ bool_item:
+ default: true
+ type: boolean
+ array_item:
+ items:
+ type: integer
+ type: array
+ required:
+ - array_item
+ - bool_item
+ - integer_item
+ - number_item
+ - string_item
+ type: object
+ TypeHolderExample:
+ properties:
+ string_item:
+ example: what
+ type: string
+ number_item:
+ example: 1.234
+ type: number
+ integer_item:
+ example: -2
+ type: integer
+ bool_item:
+ example: true
+ type: boolean
+ array_item:
+ example:
+ - 0
+ - 1
+ - 2
+ - 3
+ items:
+ type: integer
+ type: array
+ required:
+ - array_item
+ - bool_item
+ - integer_item
+ - number_item
+ - string_item
+ type: object
+ XmlItem:
+ properties:
+ attribute_string:
+ example: string
+ type: string
+ xml:
+ attribute: true
+ attribute_number:
+ example: 1.234
+ type: number
+ xml:
+ attribute: true
+ attribute_integer:
+ example: -2
+ type: integer
+ xml:
+ attribute: true
+ attribute_boolean:
+ example: true
+ type: boolean
+ xml:
+ attribute: true
+ wrapped_array:
+ items:
+ type: integer
+ type: array
+ xml:
+ wrapped: true
+ name_string:
+ example: string
+ type: string
+ xml:
+ name: xml_name_string
+ name_number:
+ example: 1.234
+ type: number
+ xml:
+ name: xml_name_number
+ name_integer:
+ example: -2
+ type: integer
+ xml:
+ name: xml_name_integer
+ name_boolean:
+ example: true
+ type: boolean
+ xml:
+ name: xml_name_boolean
+ name_array:
+ items:
+ type: integer
+ xml:
+ name: xml_name_array_item
+ type: array
+ name_wrapped_array:
+ items:
+ type: integer
+ xml:
+ name: xml_name_wrapped_array_item
+ type: array
+ xml:
+ name: xml_name_wrapped_array
+ wrapped: true
+ prefix_string:
+ example: string
+ type: string
+ xml:
+ prefix: ab
+ prefix_number:
+ example: 1.234
+ type: number
+ xml:
+ prefix: cd
+ prefix_integer:
+ example: -2
+ type: integer
+ xml:
+ prefix: ef
+ prefix_boolean:
+ example: true
+ type: boolean
+ xml:
+ prefix: gh
+ prefix_array:
+ items:
+ type: integer
+ xml:
+ prefix: ij
+ type: array
+ prefix_wrapped_array:
+ items:
+ type: integer
+ xml:
+ prefix: mn
+ type: array
+ xml:
+ prefix: kl
+ wrapped: true
+ namespace_string:
+ example: string
+ type: string
+ xml:
+ namespace: http://a.com/schema
+ namespace_number:
+ example: 1.234
+ type: number
+ xml:
+ namespace: http://b.com/schema
+ namespace_integer:
+ example: -2
+ type: integer
+ xml:
+ namespace: http://c.com/schema
+ namespace_boolean:
+ example: true
+ type: boolean
+ xml:
+ namespace: http://d.com/schema
+ namespace_array:
+ items:
+ type: integer
+ xml:
+ namespace: http://e.com/schema
+ type: array
+ namespace_wrapped_array:
+ items:
+ type: integer
+ xml:
+ namespace: http://g.com/schema
+ type: array
+ xml:
+ namespace: http://f.com/schema
+ wrapped: true
+ prefix_ns_string:
+ example: string
+ type: string
+ xml:
+ namespace: http://a.com/schema
+ prefix: a
+ prefix_ns_number:
+ example: 1.234
+ type: number
+ xml:
+ namespace: http://b.com/schema
+ prefix: b
+ prefix_ns_integer:
+ example: -2
+ type: integer
+ xml:
+ namespace: http://c.com/schema
+ prefix: c
+ prefix_ns_boolean:
+ example: true
+ type: boolean
+ xml:
+ namespace: http://d.com/schema
+ prefix: d
+ prefix_ns_array:
+ items:
+ type: integer
+ xml:
+ namespace: http://e.com/schema
+ prefix: e
+ type: array
+ prefix_ns_wrapped_array:
+ items:
+ type: integer
+ xml:
+ namespace: http://g.com/schema
+ prefix: g
+ type: array
+ xml:
+ namespace: http://f.com/schema
+ prefix: f
+ wrapped: true
+ type: object
+ xml:
+ namespace: http://a.com/schema
+ prefix: pre
+ Dog_allOf:
+ properties:
+ breed:
+ type: string
+ Cat_allOf:
+ properties:
+ declawed:
+ type: boolean
+ securitySchemes:
+ petstore_auth:
+ flows:
+ implicit:
+ authorizationUrl: http://petstore.swagger.io/api/oauth/dialog
+ scopes:
+ write:pets: modify pets in your account
+ read:pets: read your pets
+ type: oauth2
+ api_key:
+ in: header
+ name: api_key
+ type: apiKey
+ api_key_query:
+ in: query
+ name: api_key_query
+ type: apiKey
+ http_basic_test:
+ scheme: basic
+ type: http
diff --git a/samples/client/petstore/go-experimental/go-petstore/api_another_fake.go b/samples/client/petstore/go-experimental/go-petstore/api_another_fake.go
new file mode 100644
index 000000000000..152bf5be285b
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/api_another_fake.go
@@ -0,0 +1,113 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * API version: 1.0.0
+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)
+ */
+
+package petstore
+
+import (
+ "context"
+ "io/ioutil"
+ "net/http"
+ "net/url"
+)
+
+// Linger please
+var (
+ _ context.Context
+)
+
+type AnotherFakeApiService service
+
+/*
+AnotherFakeApiService To test special tags
+To test special tags and operation ID starting with number
+ * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
+ * @param body client model
+@return Client
+*/
+func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx context.Context, body Client) (Client, *http.Response, error) {
+ var (
+ localVarHttpMethod = http.MethodPatch
+ localVarPostBody interface{}
+ localVarFormFileName string
+ localVarFileName string
+ localVarFileBytes []byte
+ localVarReturnValue Client
+ )
+
+ // create path and map variables
+ localVarPath := a.client.cfg.BasePath + "/another-fake/dummy"
+
+ localVarHeaderParams := make(map[string]string)
+ localVarQueryParams := url.Values{}
+ localVarFormParams := url.Values{}
+
+ // to determine the Content-Type header
+ localVarHttpContentTypes := []string{"application/json"}
+
+ // set Content-Type header
+ localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
+ if localVarHttpContentType != "" {
+ localVarHeaderParams["Content-Type"] = localVarHttpContentType
+ }
+
+ // to determine the Accept header
+ localVarHttpHeaderAccepts := []string{"application/json"}
+
+ // set Accept header
+ localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
+ if localVarHttpHeaderAccept != "" {
+ localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
+ }
+ // body params
+ localVarPostBody = &body
+ r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
+ if err != nil {
+ return localVarReturnValue, nil, err
+ }
+
+ localVarHttpResponse, err := a.client.callAPI(r)
+ if err != nil || localVarHttpResponse == nil {
+ return localVarReturnValue, localVarHttpResponse, err
+ }
+
+ localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
+ localVarHttpResponse.Body.Close()
+ if err != nil {
+ return localVarReturnValue, localVarHttpResponse, err
+ }
+
+ if localVarHttpResponse.StatusCode >= 300 {
+ newErr := GenericOpenAPIError{
+ body: localVarBody,
+ error: localVarHttpResponse.Status,
+ }
+ if localVarHttpResponse.StatusCode == 200 {
+ var v Client
+ err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
+ if err != nil {
+ newErr.error = err.Error()
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+ newErr.model = v
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+
+ err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
+ if err != nil {
+ newErr := GenericOpenAPIError{
+ body: localVarBody,
+ error: err.Error(),
+ }
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+
+ return localVarReturnValue, localVarHttpResponse, nil
+}
diff --git a/samples/client/petstore/go-experimental/go-petstore/api_fake.go b/samples/client/petstore/go-experimental/go-petstore/api_fake.go
new file mode 100644
index 000000000000..e6a157d6cec2
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/api_fake.go
@@ -0,0 +1,1208 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * API version: 1.0.0
+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)
+ */
+
+package petstore
+
+import (
+ "context"
+ "io/ioutil"
+ "net/http"
+ "net/url"
+ "github.com/antihax/optional"
+ "os"
+)
+
+// Linger please
+var (
+ _ context.Context
+)
+
+type FakeApiService service
+
+/*
+FakeApiService creates an XmlItem
+this route creates an XmlItem
+ * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
+ * @param xmlItem XmlItem Body
+*/
+func (a *FakeApiService) CreateXmlItem(ctx context.Context, xmlItem XmlItem) (*http.Response, error) {
+ var (
+ localVarHttpMethod = http.MethodPost
+ localVarPostBody interface{}
+ localVarFormFileName string
+ localVarFileName string
+ localVarFileBytes []byte
+ )
+
+ // create path and map variables
+ localVarPath := a.client.cfg.BasePath + "/fake/create_xml_item"
+
+ localVarHeaderParams := make(map[string]string)
+ localVarQueryParams := url.Values{}
+ localVarFormParams := url.Values{}
+
+ // to determine the Content-Type header
+ localVarHttpContentTypes := []string{"application/xml", "application/xml; charset=utf-8", "application/xml; charset=utf-16", "text/xml", "text/xml; charset=utf-8", "text/xml; charset=utf-16"}
+
+ // set Content-Type header
+ localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
+ if localVarHttpContentType != "" {
+ localVarHeaderParams["Content-Type"] = localVarHttpContentType
+ }
+
+ // to determine the Accept header
+ localVarHttpHeaderAccepts := []string{}
+
+ // set Accept header
+ localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
+ if localVarHttpHeaderAccept != "" {
+ localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
+ }
+ // body params
+ localVarPostBody = &xmlItem
+ r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
+ if err != nil {
+ return nil, err
+ }
+
+ localVarHttpResponse, err := a.client.callAPI(r)
+ if err != nil || localVarHttpResponse == nil {
+ return localVarHttpResponse, err
+ }
+
+ localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
+ localVarHttpResponse.Body.Close()
+ if err != nil {
+ return localVarHttpResponse, err
+ }
+
+ if localVarHttpResponse.StatusCode >= 300 {
+ newErr := GenericOpenAPIError{
+ body: localVarBody,
+ error: localVarHttpResponse.Status,
+ }
+ return localVarHttpResponse, newErr
+ }
+
+ return localVarHttpResponse, nil
+}
+
+/*
+FakeApiService
+Test serialization of outer boolean types
+ * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
+ * @param optional nil or *FakeOuterBooleanSerializeOpts - Optional Parameters:
+ * @param "Body" (optional.Bool) - Input boolean as post body
+@return bool
+*/
+
+type FakeOuterBooleanSerializeOpts struct {
+ Body optional.Bool
+}
+
+func (a *FakeApiService) FakeOuterBooleanSerialize(ctx context.Context, localVarOptionals *FakeOuterBooleanSerializeOpts) (bool, *http.Response, error) {
+ var (
+ localVarHttpMethod = http.MethodPost
+ localVarPostBody interface{}
+ localVarFormFileName string
+ localVarFileName string
+ localVarFileBytes []byte
+ localVarReturnValue bool
+ )
+
+ // create path and map variables
+ localVarPath := a.client.cfg.BasePath + "/fake/outer/boolean"
+
+ localVarHeaderParams := make(map[string]string)
+ localVarQueryParams := url.Values{}
+ localVarFormParams := url.Values{}
+
+ // to determine the Content-Type header
+ localVarHttpContentTypes := []string{}
+
+ // set Content-Type header
+ localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
+ if localVarHttpContentType != "" {
+ localVarHeaderParams["Content-Type"] = localVarHttpContentType
+ }
+
+ // to determine the Accept header
+ localVarHttpHeaderAccepts := []string{"*/*"}
+
+ // set Accept header
+ localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
+ if localVarHttpHeaderAccept != "" {
+ localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
+ }
+ // body params
+ if localVarOptionals != nil && localVarOptionals.Body.IsSet() {
+ localVarPostBody = localVarOptionals.Body.Value()
+ }
+
+ r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
+ if err != nil {
+ return localVarReturnValue, nil, err
+ }
+
+ localVarHttpResponse, err := a.client.callAPI(r)
+ if err != nil || localVarHttpResponse == nil {
+ return localVarReturnValue, localVarHttpResponse, err
+ }
+
+ localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
+ localVarHttpResponse.Body.Close()
+ if err != nil {
+ return localVarReturnValue, localVarHttpResponse, err
+ }
+
+ if localVarHttpResponse.StatusCode >= 300 {
+ newErr := GenericOpenAPIError{
+ body: localVarBody,
+ error: localVarHttpResponse.Status,
+ }
+ if localVarHttpResponse.StatusCode == 200 {
+ var v bool
+ err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
+ if err != nil {
+ newErr.error = err.Error()
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+ newErr.model = v
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+
+ err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
+ if err != nil {
+ newErr := GenericOpenAPIError{
+ body: localVarBody,
+ error: err.Error(),
+ }
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+
+ return localVarReturnValue, localVarHttpResponse, nil
+}
+
+/*
+FakeApiService
+Test serialization of object with outer number type
+ * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
+ * @param optional nil or *FakeOuterCompositeSerializeOpts - Optional Parameters:
+ * @param "Body" (optional.Interface of OuterComposite) - Input composite as post body
+@return OuterComposite
+*/
+
+type FakeOuterCompositeSerializeOpts struct {
+ Body optional.Interface
+}
+
+func (a *FakeApiService) FakeOuterCompositeSerialize(ctx context.Context, localVarOptionals *FakeOuterCompositeSerializeOpts) (OuterComposite, *http.Response, error) {
+ var (
+ localVarHttpMethod = http.MethodPost
+ localVarPostBody interface{}
+ localVarFormFileName string
+ localVarFileName string
+ localVarFileBytes []byte
+ localVarReturnValue OuterComposite
+ )
+
+ // create path and map variables
+ localVarPath := a.client.cfg.BasePath + "/fake/outer/composite"
+
+ localVarHeaderParams := make(map[string]string)
+ localVarQueryParams := url.Values{}
+ localVarFormParams := url.Values{}
+
+ // to determine the Content-Type header
+ localVarHttpContentTypes := []string{}
+
+ // set Content-Type header
+ localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
+ if localVarHttpContentType != "" {
+ localVarHeaderParams["Content-Type"] = localVarHttpContentType
+ }
+
+ // to determine the Accept header
+ localVarHttpHeaderAccepts := []string{"*/*"}
+
+ // set Accept header
+ localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
+ if localVarHttpHeaderAccept != "" {
+ localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
+ }
+ // body params
+ if localVarOptionals != nil && localVarOptionals.Body.IsSet() {
+ localVarOptionalBody, localVarOptionalBodyok := localVarOptionals.Body.Value().(OuterComposite)
+ if !localVarOptionalBodyok {
+ return localVarReturnValue, nil, reportError("body should be OuterComposite")
+ }
+ localVarPostBody = &localVarOptionalBody
+ }
+
+ r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
+ if err != nil {
+ return localVarReturnValue, nil, err
+ }
+
+ localVarHttpResponse, err := a.client.callAPI(r)
+ if err != nil || localVarHttpResponse == nil {
+ return localVarReturnValue, localVarHttpResponse, err
+ }
+
+ localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
+ localVarHttpResponse.Body.Close()
+ if err != nil {
+ return localVarReturnValue, localVarHttpResponse, err
+ }
+
+ if localVarHttpResponse.StatusCode >= 300 {
+ newErr := GenericOpenAPIError{
+ body: localVarBody,
+ error: localVarHttpResponse.Status,
+ }
+ if localVarHttpResponse.StatusCode == 200 {
+ var v OuterComposite
+ err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
+ if err != nil {
+ newErr.error = err.Error()
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+ newErr.model = v
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+
+ err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
+ if err != nil {
+ newErr := GenericOpenAPIError{
+ body: localVarBody,
+ error: err.Error(),
+ }
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+
+ return localVarReturnValue, localVarHttpResponse, nil
+}
+
+/*
+FakeApiService
+Test serialization of outer number types
+ * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
+ * @param optional nil or *FakeOuterNumberSerializeOpts - Optional Parameters:
+ * @param "Body" (optional.Float32) - Input number as post body
+@return float32
+*/
+
+type FakeOuterNumberSerializeOpts struct {
+ Body optional.Float32
+}
+
+func (a *FakeApiService) FakeOuterNumberSerialize(ctx context.Context, localVarOptionals *FakeOuterNumberSerializeOpts) (float32, *http.Response, error) {
+ var (
+ localVarHttpMethod = http.MethodPost
+ localVarPostBody interface{}
+ localVarFormFileName string
+ localVarFileName string
+ localVarFileBytes []byte
+ localVarReturnValue float32
+ )
+
+ // create path and map variables
+ localVarPath := a.client.cfg.BasePath + "/fake/outer/number"
+
+ localVarHeaderParams := make(map[string]string)
+ localVarQueryParams := url.Values{}
+ localVarFormParams := url.Values{}
+
+ // to determine the Content-Type header
+ localVarHttpContentTypes := []string{}
+
+ // set Content-Type header
+ localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
+ if localVarHttpContentType != "" {
+ localVarHeaderParams["Content-Type"] = localVarHttpContentType
+ }
+
+ // to determine the Accept header
+ localVarHttpHeaderAccepts := []string{"*/*"}
+
+ // set Accept header
+ localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
+ if localVarHttpHeaderAccept != "" {
+ localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
+ }
+ // body params
+ if localVarOptionals != nil && localVarOptionals.Body.IsSet() {
+ localVarPostBody = localVarOptionals.Body.Value()
+ }
+
+ r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
+ if err != nil {
+ return localVarReturnValue, nil, err
+ }
+
+ localVarHttpResponse, err := a.client.callAPI(r)
+ if err != nil || localVarHttpResponse == nil {
+ return localVarReturnValue, localVarHttpResponse, err
+ }
+
+ localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
+ localVarHttpResponse.Body.Close()
+ if err != nil {
+ return localVarReturnValue, localVarHttpResponse, err
+ }
+
+ if localVarHttpResponse.StatusCode >= 300 {
+ newErr := GenericOpenAPIError{
+ body: localVarBody,
+ error: localVarHttpResponse.Status,
+ }
+ if localVarHttpResponse.StatusCode == 200 {
+ var v float32
+ err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
+ if err != nil {
+ newErr.error = err.Error()
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+ newErr.model = v
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+
+ err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
+ if err != nil {
+ newErr := GenericOpenAPIError{
+ body: localVarBody,
+ error: err.Error(),
+ }
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+
+ return localVarReturnValue, localVarHttpResponse, nil
+}
+
+/*
+FakeApiService
+Test serialization of outer string types
+ * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
+ * @param optional nil or *FakeOuterStringSerializeOpts - Optional Parameters:
+ * @param "Body" (optional.String) - Input string as post body
+@return string
+*/
+
+type FakeOuterStringSerializeOpts struct {
+ Body optional.String
+}
+
+func (a *FakeApiService) FakeOuterStringSerialize(ctx context.Context, localVarOptionals *FakeOuterStringSerializeOpts) (string, *http.Response, error) {
+ var (
+ localVarHttpMethod = http.MethodPost
+ localVarPostBody interface{}
+ localVarFormFileName string
+ localVarFileName string
+ localVarFileBytes []byte
+ localVarReturnValue string
+ )
+
+ // create path and map variables
+ localVarPath := a.client.cfg.BasePath + "/fake/outer/string"
+
+ localVarHeaderParams := make(map[string]string)
+ localVarQueryParams := url.Values{}
+ localVarFormParams := url.Values{}
+
+ // to determine the Content-Type header
+ localVarHttpContentTypes := []string{}
+
+ // set Content-Type header
+ localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
+ if localVarHttpContentType != "" {
+ localVarHeaderParams["Content-Type"] = localVarHttpContentType
+ }
+
+ // to determine the Accept header
+ localVarHttpHeaderAccepts := []string{"*/*"}
+
+ // set Accept header
+ localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
+ if localVarHttpHeaderAccept != "" {
+ localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
+ }
+ // body params
+ if localVarOptionals != nil && localVarOptionals.Body.IsSet() {
+ localVarPostBody = localVarOptionals.Body.Value()
+ }
+
+ r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
+ if err != nil {
+ return localVarReturnValue, nil, err
+ }
+
+ localVarHttpResponse, err := a.client.callAPI(r)
+ if err != nil || localVarHttpResponse == nil {
+ return localVarReturnValue, localVarHttpResponse, err
+ }
+
+ localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
+ localVarHttpResponse.Body.Close()
+ if err != nil {
+ return localVarReturnValue, localVarHttpResponse, err
+ }
+
+ if localVarHttpResponse.StatusCode >= 300 {
+ newErr := GenericOpenAPIError{
+ body: localVarBody,
+ error: localVarHttpResponse.Status,
+ }
+ if localVarHttpResponse.StatusCode == 200 {
+ var v string
+ err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
+ if err != nil {
+ newErr.error = err.Error()
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+ newErr.model = v
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+
+ err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
+ if err != nil {
+ newErr := GenericOpenAPIError{
+ body: localVarBody,
+ error: err.Error(),
+ }
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+
+ return localVarReturnValue, localVarHttpResponse, nil
+}
+
+/*
+FakeApiService
+For this test, the body for this request much reference a schema named `File`.
+ * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
+ * @param body
+*/
+func (a *FakeApiService) TestBodyWithFileSchema(ctx context.Context, body FileSchemaTestClass) (*http.Response, error) {
+ var (
+ localVarHttpMethod = http.MethodPut
+ localVarPostBody interface{}
+ localVarFormFileName string
+ localVarFileName string
+ localVarFileBytes []byte
+ )
+
+ // create path and map variables
+ localVarPath := a.client.cfg.BasePath + "/fake/body-with-file-schema"
+
+ localVarHeaderParams := make(map[string]string)
+ localVarQueryParams := url.Values{}
+ localVarFormParams := url.Values{}
+
+ // to determine the Content-Type header
+ localVarHttpContentTypes := []string{"application/json"}
+
+ // set Content-Type header
+ localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
+ if localVarHttpContentType != "" {
+ localVarHeaderParams["Content-Type"] = localVarHttpContentType
+ }
+
+ // to determine the Accept header
+ localVarHttpHeaderAccepts := []string{}
+
+ // set Accept header
+ localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
+ if localVarHttpHeaderAccept != "" {
+ localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
+ }
+ // body params
+ localVarPostBody = &body
+ r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
+ if err != nil {
+ return nil, err
+ }
+
+ localVarHttpResponse, err := a.client.callAPI(r)
+ if err != nil || localVarHttpResponse == nil {
+ return localVarHttpResponse, err
+ }
+
+ localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
+ localVarHttpResponse.Body.Close()
+ if err != nil {
+ return localVarHttpResponse, err
+ }
+
+ if localVarHttpResponse.StatusCode >= 300 {
+ newErr := GenericOpenAPIError{
+ body: localVarBody,
+ error: localVarHttpResponse.Status,
+ }
+ return localVarHttpResponse, newErr
+ }
+
+ return localVarHttpResponse, nil
+}
+
+/*
+FakeApiService
+ * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
+ * @param query
+ * @param body
+*/
+func (a *FakeApiService) TestBodyWithQueryParams(ctx context.Context, query string, body User) (*http.Response, error) {
+ var (
+ localVarHttpMethod = http.MethodPut
+ localVarPostBody interface{}
+ localVarFormFileName string
+ localVarFileName string
+ localVarFileBytes []byte
+ )
+
+ // create path and map variables
+ localVarPath := a.client.cfg.BasePath + "/fake/body-with-query-params"
+
+ localVarHeaderParams := make(map[string]string)
+ localVarQueryParams := url.Values{}
+ localVarFormParams := url.Values{}
+
+ localVarQueryParams.Add("query", parameterToString(query, ""))
+ // to determine the Content-Type header
+ localVarHttpContentTypes := []string{"application/json"}
+
+ // set Content-Type header
+ localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
+ if localVarHttpContentType != "" {
+ localVarHeaderParams["Content-Type"] = localVarHttpContentType
+ }
+
+ // to determine the Accept header
+ localVarHttpHeaderAccepts := []string{}
+
+ // set Accept header
+ localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
+ if localVarHttpHeaderAccept != "" {
+ localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
+ }
+ // body params
+ localVarPostBody = &body
+ r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
+ if err != nil {
+ return nil, err
+ }
+
+ localVarHttpResponse, err := a.client.callAPI(r)
+ if err != nil || localVarHttpResponse == nil {
+ return localVarHttpResponse, err
+ }
+
+ localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
+ localVarHttpResponse.Body.Close()
+ if err != nil {
+ return localVarHttpResponse, err
+ }
+
+ if localVarHttpResponse.StatusCode >= 300 {
+ newErr := GenericOpenAPIError{
+ body: localVarBody,
+ error: localVarHttpResponse.Status,
+ }
+ return localVarHttpResponse, newErr
+ }
+
+ return localVarHttpResponse, nil
+}
+
+/*
+FakeApiService To test \"client\" model
+To test \"client\" model
+ * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
+ * @param body client model
+@return Client
+*/
+func (a *FakeApiService) TestClientModel(ctx context.Context, body Client) (Client, *http.Response, error) {
+ var (
+ localVarHttpMethod = http.MethodPatch
+ localVarPostBody interface{}
+ localVarFormFileName string
+ localVarFileName string
+ localVarFileBytes []byte
+ localVarReturnValue Client
+ )
+
+ // create path and map variables
+ localVarPath := a.client.cfg.BasePath + "/fake"
+
+ localVarHeaderParams := make(map[string]string)
+ localVarQueryParams := url.Values{}
+ localVarFormParams := url.Values{}
+
+ // to determine the Content-Type header
+ localVarHttpContentTypes := []string{"application/json"}
+
+ // set Content-Type header
+ localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
+ if localVarHttpContentType != "" {
+ localVarHeaderParams["Content-Type"] = localVarHttpContentType
+ }
+
+ // to determine the Accept header
+ localVarHttpHeaderAccepts := []string{"application/json"}
+
+ // set Accept header
+ localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
+ if localVarHttpHeaderAccept != "" {
+ localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
+ }
+ // body params
+ localVarPostBody = &body
+ r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
+ if err != nil {
+ return localVarReturnValue, nil, err
+ }
+
+ localVarHttpResponse, err := a.client.callAPI(r)
+ if err != nil || localVarHttpResponse == nil {
+ return localVarReturnValue, localVarHttpResponse, err
+ }
+
+ localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
+ localVarHttpResponse.Body.Close()
+ if err != nil {
+ return localVarReturnValue, localVarHttpResponse, err
+ }
+
+ if localVarHttpResponse.StatusCode >= 300 {
+ newErr := GenericOpenAPIError{
+ body: localVarBody,
+ error: localVarHttpResponse.Status,
+ }
+ if localVarHttpResponse.StatusCode == 200 {
+ var v Client
+ err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
+ if err != nil {
+ newErr.error = err.Error()
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+ newErr.model = v
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+
+ err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
+ if err != nil {
+ newErr := GenericOpenAPIError{
+ body: localVarBody,
+ error: err.Error(),
+ }
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+
+ return localVarReturnValue, localVarHttpResponse, nil
+}
+
+/*
+FakeApiService Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
+Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
+ * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
+ * @param number None
+ * @param double None
+ * @param patternWithoutDelimiter None
+ * @param byte_ None
+ * @param optional nil or *TestEndpointParametersOpts - Optional Parameters:
+ * @param "Integer" (optional.Int32) - None
+ * @param "Int32_" (optional.Int32) - None
+ * @param "Int64_" (optional.Int64) - None
+ * @param "Float" (optional.Float32) - None
+ * @param "String_" (optional.String) - None
+ * @param "Binary" (optional.Interface of *os.File) - None
+ * @param "Date" (optional.String) - None
+ * @param "DateTime" (optional.Time) - None
+ * @param "Password" (optional.String) - None
+ * @param "Callback" (optional.String) - None
+*/
+
+type TestEndpointParametersOpts struct {
+ Integer optional.Int32
+ Int32_ optional.Int32
+ Int64_ optional.Int64
+ Float optional.Float32
+ String_ optional.String
+ Binary optional.Interface
+ Date optional.String
+ DateTime optional.Time
+ Password optional.String
+ Callback optional.String
+}
+
+func (a *FakeApiService) TestEndpointParameters(ctx context.Context, number float32, double float64, patternWithoutDelimiter string, byte_ string, localVarOptionals *TestEndpointParametersOpts) (*http.Response, error) {
+ var (
+ localVarHttpMethod = http.MethodPost
+ localVarPostBody interface{}
+ localVarFormFileName string
+ localVarFileName string
+ localVarFileBytes []byte
+ )
+
+ // create path and map variables
+ localVarPath := a.client.cfg.BasePath + "/fake"
+
+ localVarHeaderParams := make(map[string]string)
+ localVarQueryParams := url.Values{}
+ localVarFormParams := url.Values{}
+ if number < 32.1 {
+ return nil, reportError("number must be greater than 32.1")
+ }
+ if number > 543.2 {
+ return nil, reportError("number must be less than 543.2")
+ }
+ if double < 67.8 {
+ return nil, reportError("double must be greater than 67.8")
+ }
+ if double > 123.4 {
+ return nil, reportError("double must be less than 123.4")
+ }
+
+ // to determine the Content-Type header
+ localVarHttpContentTypes := []string{"application/x-www-form-urlencoded"}
+
+ // set Content-Type header
+ localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
+ if localVarHttpContentType != "" {
+ localVarHeaderParams["Content-Type"] = localVarHttpContentType
+ }
+
+ // to determine the Accept header
+ localVarHttpHeaderAccepts := []string{}
+
+ // set Accept header
+ localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
+ if localVarHttpHeaderAccept != "" {
+ localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
+ }
+ if localVarOptionals != nil && localVarOptionals.Integer.IsSet() {
+ localVarFormParams.Add("integer", parameterToString(localVarOptionals.Integer.Value(), ""))
+ }
+ if localVarOptionals != nil && localVarOptionals.Int32_.IsSet() {
+ localVarFormParams.Add("int32", parameterToString(localVarOptionals.Int32_.Value(), ""))
+ }
+ if localVarOptionals != nil && localVarOptionals.Int64_.IsSet() {
+ localVarFormParams.Add("int64", parameterToString(localVarOptionals.Int64_.Value(), ""))
+ }
+ localVarFormParams.Add("number", parameterToString(number, ""))
+ if localVarOptionals != nil && localVarOptionals.Float.IsSet() {
+ localVarFormParams.Add("float", parameterToString(localVarOptionals.Float.Value(), ""))
+ }
+ localVarFormParams.Add("double", parameterToString(double, ""))
+ if localVarOptionals != nil && localVarOptionals.String_.IsSet() {
+ localVarFormParams.Add("string", parameterToString(localVarOptionals.String_.Value(), ""))
+ }
+ localVarFormParams.Add("pattern_without_delimiter", parameterToString(patternWithoutDelimiter, ""))
+ localVarFormParams.Add("byte", parameterToString(byte_, ""))
+ localVarFormFileName = "binary"
+ var localVarFile *os.File
+ if localVarOptionals != nil && localVarOptionals.Binary.IsSet() {
+ localVarFileOk := false
+ localVarFile, localVarFileOk = localVarOptionals.Binary.Value().(*os.File)
+ if !localVarFileOk {
+ return nil, reportError("binary should be *os.File")
+ }
+ }
+ if localVarFile != nil {
+ fbs, _ := ioutil.ReadAll(localVarFile)
+ localVarFileBytes = fbs
+ localVarFileName = localVarFile.Name()
+ localVarFile.Close()
+ }
+ if localVarOptionals != nil && localVarOptionals.Date.IsSet() {
+ localVarFormParams.Add("date", parameterToString(localVarOptionals.Date.Value(), ""))
+ }
+ if localVarOptionals != nil && localVarOptionals.DateTime.IsSet() {
+ paramJson, err := parameterToJson(localVarOptionals.DateTime.Value())
+ if err != nil {
+ return nil, err
+ }
+ localVarFormParams.Add("dateTime", paramJson)
+ }
+ if localVarOptionals != nil && localVarOptionals.Password.IsSet() {
+ localVarFormParams.Add("password", parameterToString(localVarOptionals.Password.Value(), ""))
+ }
+ if localVarOptionals != nil && localVarOptionals.Callback.IsSet() {
+ localVarFormParams.Add("callback", parameterToString(localVarOptionals.Callback.Value(), ""))
+ }
+ r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
+ if err != nil {
+ return nil, err
+ }
+
+ localVarHttpResponse, err := a.client.callAPI(r)
+ if err != nil || localVarHttpResponse == nil {
+ return localVarHttpResponse, err
+ }
+
+ localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
+ localVarHttpResponse.Body.Close()
+ if err != nil {
+ return localVarHttpResponse, err
+ }
+
+ if localVarHttpResponse.StatusCode >= 300 {
+ newErr := GenericOpenAPIError{
+ body: localVarBody,
+ error: localVarHttpResponse.Status,
+ }
+ return localVarHttpResponse, newErr
+ }
+
+ return localVarHttpResponse, nil
+}
+
+/*
+FakeApiService To test enum parameters
+To test enum parameters
+ * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
+ * @param optional nil or *TestEnumParametersOpts - Optional Parameters:
+ * @param "EnumHeaderStringArray" (optional.Interface of []string) - Header parameter enum test (string array)
+ * @param "EnumHeaderString" (optional.String) - Header parameter enum test (string)
+ * @param "EnumQueryStringArray" (optional.Interface of []string) - Query parameter enum test (string array)
+ * @param "EnumQueryString" (optional.String) - Query parameter enum test (string)
+ * @param "EnumQueryInteger" (optional.Int32) - Query parameter enum test (double)
+ * @param "EnumQueryDouble" (optional.Float64) - Query parameter enum test (double)
+ * @param "EnumFormStringArray" (optional.Interface of []string) - Form parameter enum test (string array)
+ * @param "EnumFormString" (optional.String) - Form parameter enum test (string)
+*/
+
+type TestEnumParametersOpts struct {
+ EnumHeaderStringArray optional.Interface
+ EnumHeaderString optional.String
+ EnumQueryStringArray optional.Interface
+ EnumQueryString optional.String
+ EnumQueryInteger optional.Int32
+ EnumQueryDouble optional.Float64
+ EnumFormStringArray optional.Interface
+ EnumFormString optional.String
+}
+
+func (a *FakeApiService) TestEnumParameters(ctx context.Context, localVarOptionals *TestEnumParametersOpts) (*http.Response, error) {
+ var (
+ localVarHttpMethod = http.MethodGet
+ localVarPostBody interface{}
+ localVarFormFileName string
+ localVarFileName string
+ localVarFileBytes []byte
+ )
+
+ // create path and map variables
+ localVarPath := a.client.cfg.BasePath + "/fake"
+
+ localVarHeaderParams := make(map[string]string)
+ localVarQueryParams := url.Values{}
+ localVarFormParams := url.Values{}
+
+ if localVarOptionals != nil && localVarOptionals.EnumQueryStringArray.IsSet() {
+ localVarQueryParams.Add("enum_query_string_array", parameterToString(localVarOptionals.EnumQueryStringArray.Value(), "csv"))
+ }
+ if localVarOptionals != nil && localVarOptionals.EnumQueryString.IsSet() {
+ localVarQueryParams.Add("enum_query_string", parameterToString(localVarOptionals.EnumQueryString.Value(), ""))
+ }
+ if localVarOptionals != nil && localVarOptionals.EnumQueryInteger.IsSet() {
+ localVarQueryParams.Add("enum_query_integer", parameterToString(localVarOptionals.EnumQueryInteger.Value(), ""))
+ }
+ if localVarOptionals != nil && localVarOptionals.EnumQueryDouble.IsSet() {
+ localVarQueryParams.Add("enum_query_double", parameterToString(localVarOptionals.EnumQueryDouble.Value(), ""))
+ }
+ // to determine the Content-Type header
+ localVarHttpContentTypes := []string{"application/x-www-form-urlencoded"}
+
+ // set Content-Type header
+ localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
+ if localVarHttpContentType != "" {
+ localVarHeaderParams["Content-Type"] = localVarHttpContentType
+ }
+
+ // to determine the Accept header
+ localVarHttpHeaderAccepts := []string{}
+
+ // set Accept header
+ localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
+ if localVarHttpHeaderAccept != "" {
+ localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
+ }
+ if localVarOptionals != nil && localVarOptionals.EnumHeaderStringArray.IsSet() {
+ localVarHeaderParams["enum_header_string_array"] = parameterToString(localVarOptionals.EnumHeaderStringArray.Value(), "csv")
+ }
+ if localVarOptionals != nil && localVarOptionals.EnumHeaderString.IsSet() {
+ localVarHeaderParams["enum_header_string"] = parameterToString(localVarOptionals.EnumHeaderString.Value(), "")
+ }
+ if localVarOptionals != nil && localVarOptionals.EnumFormStringArray.IsSet() {
+ localVarFormParams.Add("enum_form_string_array", parameterToString(localVarOptionals.EnumFormStringArray.Value(), "csv"))
+ }
+ if localVarOptionals != nil && localVarOptionals.EnumFormString.IsSet() {
+ localVarFormParams.Add("enum_form_string", parameterToString(localVarOptionals.EnumFormString.Value(), ""))
+ }
+ r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
+ if err != nil {
+ return nil, err
+ }
+
+ localVarHttpResponse, err := a.client.callAPI(r)
+ if err != nil || localVarHttpResponse == nil {
+ return localVarHttpResponse, err
+ }
+
+ localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
+ localVarHttpResponse.Body.Close()
+ if err != nil {
+ return localVarHttpResponse, err
+ }
+
+ if localVarHttpResponse.StatusCode >= 300 {
+ newErr := GenericOpenAPIError{
+ body: localVarBody,
+ error: localVarHttpResponse.Status,
+ }
+ return localVarHttpResponse, newErr
+ }
+
+ return localVarHttpResponse, nil
+}
+
+/*
+FakeApiService Fake endpoint to test group parameters (optional)
+Fake endpoint to test group parameters (optional)
+ * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
+ * @param requiredStringGroup Required String in group parameters
+ * @param requiredBooleanGroup Required Boolean in group parameters
+ * @param requiredInt64Group Required Integer in group parameters
+ * @param optional nil or *TestGroupParametersOpts - Optional Parameters:
+ * @param "StringGroup" (optional.Int32) - String in group parameters
+ * @param "BooleanGroup" (optional.Bool) - Boolean in group parameters
+ * @param "Int64Group" (optional.Int64) - Integer in group parameters
+*/
+
+type TestGroupParametersOpts struct {
+ StringGroup optional.Int32
+ BooleanGroup optional.Bool
+ Int64Group optional.Int64
+}
+
+func (a *FakeApiService) TestGroupParameters(ctx context.Context, requiredStringGroup int32, requiredBooleanGroup bool, requiredInt64Group int64, localVarOptionals *TestGroupParametersOpts) (*http.Response, error) {
+ var (
+ localVarHttpMethod = http.MethodDelete
+ localVarPostBody interface{}
+ localVarFormFileName string
+ localVarFileName string
+ localVarFileBytes []byte
+ )
+
+ // create path and map variables
+ localVarPath := a.client.cfg.BasePath + "/fake"
+
+ localVarHeaderParams := make(map[string]string)
+ localVarQueryParams := url.Values{}
+ localVarFormParams := url.Values{}
+
+ localVarQueryParams.Add("required_string_group", parameterToString(requiredStringGroup, ""))
+ localVarQueryParams.Add("required_int64_group", parameterToString(requiredInt64Group, ""))
+ if localVarOptionals != nil && localVarOptionals.StringGroup.IsSet() {
+ localVarQueryParams.Add("string_group", parameterToString(localVarOptionals.StringGroup.Value(), ""))
+ }
+ if localVarOptionals != nil && localVarOptionals.Int64Group.IsSet() {
+ localVarQueryParams.Add("int64_group", parameterToString(localVarOptionals.Int64Group.Value(), ""))
+ }
+ // to determine the Content-Type header
+ localVarHttpContentTypes := []string{}
+
+ // set Content-Type header
+ localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
+ if localVarHttpContentType != "" {
+ localVarHeaderParams["Content-Type"] = localVarHttpContentType
+ }
+
+ // to determine the Accept header
+ localVarHttpHeaderAccepts := []string{}
+
+ // set Accept header
+ localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
+ if localVarHttpHeaderAccept != "" {
+ localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
+ }
+ localVarHeaderParams["required_boolean_group"] = parameterToString(requiredBooleanGroup, "")
+ if localVarOptionals != nil && localVarOptionals.BooleanGroup.IsSet() {
+ localVarHeaderParams["boolean_group"] = parameterToString(localVarOptionals.BooleanGroup.Value(), "")
+ }
+ r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
+ if err != nil {
+ return nil, err
+ }
+
+ localVarHttpResponse, err := a.client.callAPI(r)
+ if err != nil || localVarHttpResponse == nil {
+ return localVarHttpResponse, err
+ }
+
+ localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
+ localVarHttpResponse.Body.Close()
+ if err != nil {
+ return localVarHttpResponse, err
+ }
+
+ if localVarHttpResponse.StatusCode >= 300 {
+ newErr := GenericOpenAPIError{
+ body: localVarBody,
+ error: localVarHttpResponse.Status,
+ }
+ return localVarHttpResponse, newErr
+ }
+
+ return localVarHttpResponse, nil
+}
+
+/*
+FakeApiService test inline additionalProperties
+ * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
+ * @param param request body
+*/
+func (a *FakeApiService) TestInlineAdditionalProperties(ctx context.Context, param map[string]string) (*http.Response, error) {
+ var (
+ localVarHttpMethod = http.MethodPost
+ localVarPostBody interface{}
+ localVarFormFileName string
+ localVarFileName string
+ localVarFileBytes []byte
+ )
+
+ // create path and map variables
+ localVarPath := a.client.cfg.BasePath + "/fake/inline-additionalProperties"
+
+ localVarHeaderParams := make(map[string]string)
+ localVarQueryParams := url.Values{}
+ localVarFormParams := url.Values{}
+
+ // to determine the Content-Type header
+ localVarHttpContentTypes := []string{"application/json"}
+
+ // set Content-Type header
+ localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
+ if localVarHttpContentType != "" {
+ localVarHeaderParams["Content-Type"] = localVarHttpContentType
+ }
+
+ // to determine the Accept header
+ localVarHttpHeaderAccepts := []string{}
+
+ // set Accept header
+ localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
+ if localVarHttpHeaderAccept != "" {
+ localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
+ }
+ // body params
+ localVarPostBody = ¶m
+ r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
+ if err != nil {
+ return nil, err
+ }
+
+ localVarHttpResponse, err := a.client.callAPI(r)
+ if err != nil || localVarHttpResponse == nil {
+ return localVarHttpResponse, err
+ }
+
+ localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
+ localVarHttpResponse.Body.Close()
+ if err != nil {
+ return localVarHttpResponse, err
+ }
+
+ if localVarHttpResponse.StatusCode >= 300 {
+ newErr := GenericOpenAPIError{
+ body: localVarBody,
+ error: localVarHttpResponse.Status,
+ }
+ return localVarHttpResponse, newErr
+ }
+
+ return localVarHttpResponse, nil
+}
+
+/*
+FakeApiService test json serialization of form data
+ * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
+ * @param param field1
+ * @param param2 field2
+*/
+func (a *FakeApiService) TestJsonFormData(ctx context.Context, param string, param2 string) (*http.Response, error) {
+ var (
+ localVarHttpMethod = http.MethodGet
+ localVarPostBody interface{}
+ localVarFormFileName string
+ localVarFileName string
+ localVarFileBytes []byte
+ )
+
+ // create path and map variables
+ localVarPath := a.client.cfg.BasePath + "/fake/jsonFormData"
+
+ localVarHeaderParams := make(map[string]string)
+ localVarQueryParams := url.Values{}
+ localVarFormParams := url.Values{}
+
+ // to determine the Content-Type header
+ localVarHttpContentTypes := []string{"application/x-www-form-urlencoded"}
+
+ // set Content-Type header
+ localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
+ if localVarHttpContentType != "" {
+ localVarHeaderParams["Content-Type"] = localVarHttpContentType
+ }
+
+ // to determine the Accept header
+ localVarHttpHeaderAccepts := []string{}
+
+ // set Accept header
+ localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
+ if localVarHttpHeaderAccept != "" {
+ localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
+ }
+ localVarFormParams.Add("param", parameterToString(param, ""))
+ localVarFormParams.Add("param2", parameterToString(param2, ""))
+ r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
+ if err != nil {
+ return nil, err
+ }
+
+ localVarHttpResponse, err := a.client.callAPI(r)
+ if err != nil || localVarHttpResponse == nil {
+ return localVarHttpResponse, err
+ }
+
+ localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
+ localVarHttpResponse.Body.Close()
+ if err != nil {
+ return localVarHttpResponse, err
+ }
+
+ if localVarHttpResponse.StatusCode >= 300 {
+ newErr := GenericOpenAPIError{
+ body: localVarBody,
+ error: localVarHttpResponse.Status,
+ }
+ return localVarHttpResponse, newErr
+ }
+
+ return localVarHttpResponse, nil
+}
diff --git a/samples/client/petstore/go-experimental/go-petstore/api_fake_classname_tags123.go b/samples/client/petstore/go-experimental/go-petstore/api_fake_classname_tags123.go
new file mode 100644
index 000000000000..6c04d55739a9
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/api_fake_classname_tags123.go
@@ -0,0 +1,125 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * API version: 1.0.0
+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)
+ */
+
+package petstore
+
+import (
+ "context"
+ "io/ioutil"
+ "net/http"
+ "net/url"
+)
+
+// Linger please
+var (
+ _ context.Context
+)
+
+type FakeClassnameTags123ApiService service
+
+/*
+FakeClassnameTags123ApiService To test class name in snake case
+To test class name in snake case
+ * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
+ * @param body client model
+@return Client
+*/
+func (a *FakeClassnameTags123ApiService) TestClassname(ctx context.Context, body Client) (Client, *http.Response, error) {
+ var (
+ localVarHttpMethod = http.MethodPatch
+ localVarPostBody interface{}
+ localVarFormFileName string
+ localVarFileName string
+ localVarFileBytes []byte
+ localVarReturnValue Client
+ )
+
+ // create path and map variables
+ localVarPath := a.client.cfg.BasePath + "/fake_classname_test"
+
+ localVarHeaderParams := make(map[string]string)
+ localVarQueryParams := url.Values{}
+ localVarFormParams := url.Values{}
+
+ // to determine the Content-Type header
+ localVarHttpContentTypes := []string{"application/json"}
+
+ // set Content-Type header
+ localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
+ if localVarHttpContentType != "" {
+ localVarHeaderParams["Content-Type"] = localVarHttpContentType
+ }
+
+ // to determine the Accept header
+ localVarHttpHeaderAccepts := []string{"application/json"}
+
+ // set Accept header
+ localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
+ if localVarHttpHeaderAccept != "" {
+ localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
+ }
+ // body params
+ localVarPostBody = &body
+ if ctx != nil {
+ // API Key Authentication
+ if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
+ var key string
+ if auth.Prefix != "" {
+ key = auth.Prefix + " " + auth.Key
+ } else {
+ key = auth.Key
+ }
+ localVarQueryParams.Add("api_key_query", key)
+ }
+ }
+ r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
+ if err != nil {
+ return localVarReturnValue, nil, err
+ }
+
+ localVarHttpResponse, err := a.client.callAPI(r)
+ if err != nil || localVarHttpResponse == nil {
+ return localVarReturnValue, localVarHttpResponse, err
+ }
+
+ localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
+ localVarHttpResponse.Body.Close()
+ if err != nil {
+ return localVarReturnValue, localVarHttpResponse, err
+ }
+
+ if localVarHttpResponse.StatusCode >= 300 {
+ newErr := GenericOpenAPIError{
+ body: localVarBody,
+ error: localVarHttpResponse.Status,
+ }
+ if localVarHttpResponse.StatusCode == 200 {
+ var v Client
+ err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
+ if err != nil {
+ newErr.error = err.Error()
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+ newErr.model = v
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+
+ err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
+ if err != nil {
+ newErr := GenericOpenAPIError{
+ body: localVarBody,
+ error: err.Error(),
+ }
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+
+ return localVarReturnValue, localVarHttpResponse, nil
+}
diff --git a/samples/client/petstore/go-experimental/go-petstore/api_pet.go b/samples/client/petstore/go-experimental/go-petstore/api_pet.go
new file mode 100644
index 000000000000..243d16197f03
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/api_pet.go
@@ -0,0 +1,815 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * API version: 1.0.0
+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)
+ */
+
+package petstore
+
+import (
+ "context"
+ "io/ioutil"
+ "net/http"
+ "net/url"
+ "fmt"
+ "strings"
+ "github.com/antihax/optional"
+ "os"
+)
+
+// Linger please
+var (
+ _ context.Context
+)
+
+type PetApiService service
+
+/*
+PetApiService Add a new pet to the store
+ * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
+ * @param body Pet object that needs to be added to the store
+*/
+func (a *PetApiService) AddPet(ctx context.Context, body Pet) (*http.Response, error) {
+ var (
+ localVarHttpMethod = http.MethodPost
+ localVarPostBody interface{}
+ localVarFormFileName string
+ localVarFileName string
+ localVarFileBytes []byte
+ )
+
+ // create path and map variables
+ localVarPath := a.client.cfg.BasePath + "/pet"
+
+ localVarHeaderParams := make(map[string]string)
+ localVarQueryParams := url.Values{}
+ localVarFormParams := url.Values{}
+
+ // to determine the Content-Type header
+ localVarHttpContentTypes := []string{"application/json", "application/xml"}
+
+ // set Content-Type header
+ localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
+ if localVarHttpContentType != "" {
+ localVarHeaderParams["Content-Type"] = localVarHttpContentType
+ }
+
+ // to determine the Accept header
+ localVarHttpHeaderAccepts := []string{}
+
+ // set Accept header
+ localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
+ if localVarHttpHeaderAccept != "" {
+ localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
+ }
+ // body params
+ localVarPostBody = &body
+ r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
+ if err != nil {
+ return nil, err
+ }
+
+ localVarHttpResponse, err := a.client.callAPI(r)
+ if err != nil || localVarHttpResponse == nil {
+ return localVarHttpResponse, err
+ }
+
+ localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
+ localVarHttpResponse.Body.Close()
+ if err != nil {
+ return localVarHttpResponse, err
+ }
+
+ if localVarHttpResponse.StatusCode >= 300 {
+ newErr := GenericOpenAPIError{
+ body: localVarBody,
+ error: localVarHttpResponse.Status,
+ }
+ return localVarHttpResponse, newErr
+ }
+
+ return localVarHttpResponse, nil
+}
+
+/*
+PetApiService Deletes a pet
+ * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
+ * @param petId Pet id to delete
+ * @param optional nil or *DeletePetOpts - Optional Parameters:
+ * @param "ApiKey" (optional.String) -
+*/
+
+type DeletePetOpts struct {
+ ApiKey optional.String
+}
+
+func (a *PetApiService) DeletePet(ctx context.Context, petId int64, localVarOptionals *DeletePetOpts) (*http.Response, error) {
+ var (
+ localVarHttpMethod = http.MethodDelete
+ localVarPostBody interface{}
+ localVarFormFileName string
+ localVarFileName string
+ localVarFileBytes []byte
+ )
+
+ // create path and map variables
+ localVarPath := a.client.cfg.BasePath + "/pet/{petId}"
+ localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", fmt.Sprintf("%v", petId), -1)
+
+ localVarHeaderParams := make(map[string]string)
+ localVarQueryParams := url.Values{}
+ localVarFormParams := url.Values{}
+
+ // to determine the Content-Type header
+ localVarHttpContentTypes := []string{}
+
+ // set Content-Type header
+ localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
+ if localVarHttpContentType != "" {
+ localVarHeaderParams["Content-Type"] = localVarHttpContentType
+ }
+
+ // to determine the Accept header
+ localVarHttpHeaderAccepts := []string{}
+
+ // set Accept header
+ localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
+ if localVarHttpHeaderAccept != "" {
+ localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
+ }
+ if localVarOptionals != nil && localVarOptionals.ApiKey.IsSet() {
+ localVarHeaderParams["api_key"] = parameterToString(localVarOptionals.ApiKey.Value(), "")
+ }
+ r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
+ if err != nil {
+ return nil, err
+ }
+
+ localVarHttpResponse, err := a.client.callAPI(r)
+ if err != nil || localVarHttpResponse == nil {
+ return localVarHttpResponse, err
+ }
+
+ localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
+ localVarHttpResponse.Body.Close()
+ if err != nil {
+ return localVarHttpResponse, err
+ }
+
+ if localVarHttpResponse.StatusCode >= 300 {
+ newErr := GenericOpenAPIError{
+ body: localVarBody,
+ error: localVarHttpResponse.Status,
+ }
+ return localVarHttpResponse, newErr
+ }
+
+ return localVarHttpResponse, nil
+}
+
+/*
+PetApiService Finds Pets by status
+Multiple status values can be provided with comma separated strings
+ * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
+ * @param status Status values that need to be considered for filter
+@return []Pet
+*/
+func (a *PetApiService) FindPetsByStatus(ctx context.Context, status []string) ([]Pet, *http.Response, error) {
+ var (
+ localVarHttpMethod = http.MethodGet
+ localVarPostBody interface{}
+ localVarFormFileName string
+ localVarFileName string
+ localVarFileBytes []byte
+ localVarReturnValue []Pet
+ )
+
+ // create path and map variables
+ localVarPath := a.client.cfg.BasePath + "/pet/findByStatus"
+
+ localVarHeaderParams := make(map[string]string)
+ localVarQueryParams := url.Values{}
+ localVarFormParams := url.Values{}
+
+ localVarQueryParams.Add("status", parameterToString(status, "csv"))
+ // to determine the Content-Type header
+ localVarHttpContentTypes := []string{}
+
+ // set Content-Type header
+ localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
+ if localVarHttpContentType != "" {
+ localVarHeaderParams["Content-Type"] = localVarHttpContentType
+ }
+
+ // to determine the Accept header
+ localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
+
+ // set Accept header
+ localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
+ if localVarHttpHeaderAccept != "" {
+ localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
+ }
+ r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
+ if err != nil {
+ return localVarReturnValue, nil, err
+ }
+
+ localVarHttpResponse, err := a.client.callAPI(r)
+ if err != nil || localVarHttpResponse == nil {
+ return localVarReturnValue, localVarHttpResponse, err
+ }
+
+ localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
+ localVarHttpResponse.Body.Close()
+ if err != nil {
+ return localVarReturnValue, localVarHttpResponse, err
+ }
+
+ if localVarHttpResponse.StatusCode >= 300 {
+ newErr := GenericOpenAPIError{
+ body: localVarBody,
+ error: localVarHttpResponse.Status,
+ }
+ if localVarHttpResponse.StatusCode == 200 {
+ var v []Pet
+ err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
+ if err != nil {
+ newErr.error = err.Error()
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+ newErr.model = v
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+
+ err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
+ if err != nil {
+ newErr := GenericOpenAPIError{
+ body: localVarBody,
+ error: err.Error(),
+ }
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+
+ return localVarReturnValue, localVarHttpResponse, nil
+}
+
+/*
+PetApiService Finds Pets by tags
+Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
+ * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
+ * @param tags Tags to filter by
+@return []Pet
+*/
+func (a *PetApiService) FindPetsByTags(ctx context.Context, tags []string) ([]Pet, *http.Response, error) {
+ var (
+ localVarHttpMethod = http.MethodGet
+ localVarPostBody interface{}
+ localVarFormFileName string
+ localVarFileName string
+ localVarFileBytes []byte
+ localVarReturnValue []Pet
+ )
+
+ // create path and map variables
+ localVarPath := a.client.cfg.BasePath + "/pet/findByTags"
+
+ localVarHeaderParams := make(map[string]string)
+ localVarQueryParams := url.Values{}
+ localVarFormParams := url.Values{}
+
+ localVarQueryParams.Add("tags", parameterToString(tags, "csv"))
+ // to determine the Content-Type header
+ localVarHttpContentTypes := []string{}
+
+ // set Content-Type header
+ localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
+ if localVarHttpContentType != "" {
+ localVarHeaderParams["Content-Type"] = localVarHttpContentType
+ }
+
+ // to determine the Accept header
+ localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
+
+ // set Accept header
+ localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
+ if localVarHttpHeaderAccept != "" {
+ localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
+ }
+ r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
+ if err != nil {
+ return localVarReturnValue, nil, err
+ }
+
+ localVarHttpResponse, err := a.client.callAPI(r)
+ if err != nil || localVarHttpResponse == nil {
+ return localVarReturnValue, localVarHttpResponse, err
+ }
+
+ localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
+ localVarHttpResponse.Body.Close()
+ if err != nil {
+ return localVarReturnValue, localVarHttpResponse, err
+ }
+
+ if localVarHttpResponse.StatusCode >= 300 {
+ newErr := GenericOpenAPIError{
+ body: localVarBody,
+ error: localVarHttpResponse.Status,
+ }
+ if localVarHttpResponse.StatusCode == 200 {
+ var v []Pet
+ err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
+ if err != nil {
+ newErr.error = err.Error()
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+ newErr.model = v
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+
+ err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
+ if err != nil {
+ newErr := GenericOpenAPIError{
+ body: localVarBody,
+ error: err.Error(),
+ }
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+
+ return localVarReturnValue, localVarHttpResponse, nil
+}
+
+/*
+PetApiService Find pet by ID
+Returns a single pet
+ * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
+ * @param petId ID of pet to return
+@return Pet
+*/
+func (a *PetApiService) GetPetById(ctx context.Context, petId int64) (Pet, *http.Response, error) {
+ var (
+ localVarHttpMethod = http.MethodGet
+ localVarPostBody interface{}
+ localVarFormFileName string
+ localVarFileName string
+ localVarFileBytes []byte
+ localVarReturnValue Pet
+ )
+
+ // create path and map variables
+ localVarPath := a.client.cfg.BasePath + "/pet/{petId}"
+ localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", fmt.Sprintf("%v", petId), -1)
+
+ localVarHeaderParams := make(map[string]string)
+ localVarQueryParams := url.Values{}
+ localVarFormParams := url.Values{}
+
+ // to determine the Content-Type header
+ localVarHttpContentTypes := []string{}
+
+ // set Content-Type header
+ localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
+ if localVarHttpContentType != "" {
+ localVarHeaderParams["Content-Type"] = localVarHttpContentType
+ }
+
+ // to determine the Accept header
+ localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
+
+ // set Accept header
+ localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
+ if localVarHttpHeaderAccept != "" {
+ localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
+ }
+ if ctx != nil {
+ // API Key Authentication
+ if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
+ var key string
+ if auth.Prefix != "" {
+ key = auth.Prefix + " " + auth.Key
+ } else {
+ key = auth.Key
+ }
+ localVarHeaderParams["api_key"] = key
+ }
+ }
+ r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
+ if err != nil {
+ return localVarReturnValue, nil, err
+ }
+
+ localVarHttpResponse, err := a.client.callAPI(r)
+ if err != nil || localVarHttpResponse == nil {
+ return localVarReturnValue, localVarHttpResponse, err
+ }
+
+ localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
+ localVarHttpResponse.Body.Close()
+ if err != nil {
+ return localVarReturnValue, localVarHttpResponse, err
+ }
+
+ if localVarHttpResponse.StatusCode >= 300 {
+ newErr := GenericOpenAPIError{
+ body: localVarBody,
+ error: localVarHttpResponse.Status,
+ }
+ if localVarHttpResponse.StatusCode == 200 {
+ var v Pet
+ err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
+ if err != nil {
+ newErr.error = err.Error()
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+ newErr.model = v
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+
+ err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
+ if err != nil {
+ newErr := GenericOpenAPIError{
+ body: localVarBody,
+ error: err.Error(),
+ }
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+
+ return localVarReturnValue, localVarHttpResponse, nil
+}
+
+/*
+PetApiService Update an existing pet
+ * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
+ * @param body Pet object that needs to be added to the store
+*/
+func (a *PetApiService) UpdatePet(ctx context.Context, body Pet) (*http.Response, error) {
+ var (
+ localVarHttpMethod = http.MethodPut
+ localVarPostBody interface{}
+ localVarFormFileName string
+ localVarFileName string
+ localVarFileBytes []byte
+ )
+
+ // create path and map variables
+ localVarPath := a.client.cfg.BasePath + "/pet"
+
+ localVarHeaderParams := make(map[string]string)
+ localVarQueryParams := url.Values{}
+ localVarFormParams := url.Values{}
+
+ // to determine the Content-Type header
+ localVarHttpContentTypes := []string{"application/json", "application/xml"}
+
+ // set Content-Type header
+ localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
+ if localVarHttpContentType != "" {
+ localVarHeaderParams["Content-Type"] = localVarHttpContentType
+ }
+
+ // to determine the Accept header
+ localVarHttpHeaderAccepts := []string{}
+
+ // set Accept header
+ localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
+ if localVarHttpHeaderAccept != "" {
+ localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
+ }
+ // body params
+ localVarPostBody = &body
+ r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
+ if err != nil {
+ return nil, err
+ }
+
+ localVarHttpResponse, err := a.client.callAPI(r)
+ if err != nil || localVarHttpResponse == nil {
+ return localVarHttpResponse, err
+ }
+
+ localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
+ localVarHttpResponse.Body.Close()
+ if err != nil {
+ return localVarHttpResponse, err
+ }
+
+ if localVarHttpResponse.StatusCode >= 300 {
+ newErr := GenericOpenAPIError{
+ body: localVarBody,
+ error: localVarHttpResponse.Status,
+ }
+ return localVarHttpResponse, newErr
+ }
+
+ return localVarHttpResponse, nil
+}
+
+/*
+PetApiService Updates a pet in the store with form data
+ * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
+ * @param petId ID of pet that needs to be updated
+ * @param optional nil or *UpdatePetWithFormOpts - Optional Parameters:
+ * @param "Name" (optional.String) - Updated name of the pet
+ * @param "Status" (optional.String) - Updated status of the pet
+*/
+
+type UpdatePetWithFormOpts struct {
+ Name optional.String
+ Status optional.String
+}
+
+func (a *PetApiService) UpdatePetWithForm(ctx context.Context, petId int64, localVarOptionals *UpdatePetWithFormOpts) (*http.Response, error) {
+ var (
+ localVarHttpMethod = http.MethodPost
+ localVarPostBody interface{}
+ localVarFormFileName string
+ localVarFileName string
+ localVarFileBytes []byte
+ )
+
+ // create path and map variables
+ localVarPath := a.client.cfg.BasePath + "/pet/{petId}"
+ localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", fmt.Sprintf("%v", petId), -1)
+
+ localVarHeaderParams := make(map[string]string)
+ localVarQueryParams := url.Values{}
+ localVarFormParams := url.Values{}
+
+ // to determine the Content-Type header
+ localVarHttpContentTypes := []string{"application/x-www-form-urlencoded"}
+
+ // set Content-Type header
+ localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
+ if localVarHttpContentType != "" {
+ localVarHeaderParams["Content-Type"] = localVarHttpContentType
+ }
+
+ // to determine the Accept header
+ localVarHttpHeaderAccepts := []string{}
+
+ // set Accept header
+ localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
+ if localVarHttpHeaderAccept != "" {
+ localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
+ }
+ if localVarOptionals != nil && localVarOptionals.Name.IsSet() {
+ localVarFormParams.Add("name", parameterToString(localVarOptionals.Name.Value(), ""))
+ }
+ if localVarOptionals != nil && localVarOptionals.Status.IsSet() {
+ localVarFormParams.Add("status", parameterToString(localVarOptionals.Status.Value(), ""))
+ }
+ r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
+ if err != nil {
+ return nil, err
+ }
+
+ localVarHttpResponse, err := a.client.callAPI(r)
+ if err != nil || localVarHttpResponse == nil {
+ return localVarHttpResponse, err
+ }
+
+ localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
+ localVarHttpResponse.Body.Close()
+ if err != nil {
+ return localVarHttpResponse, err
+ }
+
+ if localVarHttpResponse.StatusCode >= 300 {
+ newErr := GenericOpenAPIError{
+ body: localVarBody,
+ error: localVarHttpResponse.Status,
+ }
+ return localVarHttpResponse, newErr
+ }
+
+ return localVarHttpResponse, nil
+}
+
+/*
+PetApiService uploads an image
+ * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
+ * @param petId ID of pet to update
+ * @param optional nil or *UploadFileOpts - Optional Parameters:
+ * @param "AdditionalMetadata" (optional.String) - Additional data to pass to server
+ * @param "File" (optional.Interface of *os.File) - file to upload
+@return ApiResponse
+*/
+
+type UploadFileOpts struct {
+ AdditionalMetadata optional.String
+ File optional.Interface
+}
+
+func (a *PetApiService) UploadFile(ctx context.Context, petId int64, localVarOptionals *UploadFileOpts) (ApiResponse, *http.Response, error) {
+ var (
+ localVarHttpMethod = http.MethodPost
+ localVarPostBody interface{}
+ localVarFormFileName string
+ localVarFileName string
+ localVarFileBytes []byte
+ localVarReturnValue ApiResponse
+ )
+
+ // create path and map variables
+ localVarPath := a.client.cfg.BasePath + "/pet/{petId}/uploadImage"
+ localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", fmt.Sprintf("%v", petId), -1)
+
+ localVarHeaderParams := make(map[string]string)
+ localVarQueryParams := url.Values{}
+ localVarFormParams := url.Values{}
+
+ // to determine the Content-Type header
+ localVarHttpContentTypes := []string{"multipart/form-data"}
+
+ // set Content-Type header
+ localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
+ if localVarHttpContentType != "" {
+ localVarHeaderParams["Content-Type"] = localVarHttpContentType
+ }
+
+ // to determine the Accept header
+ localVarHttpHeaderAccepts := []string{"application/json"}
+
+ // set Accept header
+ localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
+ if localVarHttpHeaderAccept != "" {
+ localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
+ }
+ if localVarOptionals != nil && localVarOptionals.AdditionalMetadata.IsSet() {
+ localVarFormParams.Add("additionalMetadata", parameterToString(localVarOptionals.AdditionalMetadata.Value(), ""))
+ }
+ localVarFormFileName = "file"
+ var localVarFile *os.File
+ if localVarOptionals != nil && localVarOptionals.File.IsSet() {
+ localVarFileOk := false
+ localVarFile, localVarFileOk = localVarOptionals.File.Value().(*os.File)
+ if !localVarFileOk {
+ return localVarReturnValue, nil, reportError("file should be *os.File")
+ }
+ }
+ if localVarFile != nil {
+ fbs, _ := ioutil.ReadAll(localVarFile)
+ localVarFileBytes = fbs
+ localVarFileName = localVarFile.Name()
+ localVarFile.Close()
+ }
+ r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
+ if err != nil {
+ return localVarReturnValue, nil, err
+ }
+
+ localVarHttpResponse, err := a.client.callAPI(r)
+ if err != nil || localVarHttpResponse == nil {
+ return localVarReturnValue, localVarHttpResponse, err
+ }
+
+ localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
+ localVarHttpResponse.Body.Close()
+ if err != nil {
+ return localVarReturnValue, localVarHttpResponse, err
+ }
+
+ if localVarHttpResponse.StatusCode >= 300 {
+ newErr := GenericOpenAPIError{
+ body: localVarBody,
+ error: localVarHttpResponse.Status,
+ }
+ if localVarHttpResponse.StatusCode == 200 {
+ var v ApiResponse
+ err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
+ if err != nil {
+ newErr.error = err.Error()
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+ newErr.model = v
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+
+ err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
+ if err != nil {
+ newErr := GenericOpenAPIError{
+ body: localVarBody,
+ error: err.Error(),
+ }
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+
+ return localVarReturnValue, localVarHttpResponse, nil
+}
+
+/*
+PetApiService uploads an image (required)
+ * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
+ * @param petId ID of pet to update
+ * @param requiredFile file to upload
+ * @param optional nil or *UploadFileWithRequiredFileOpts - Optional Parameters:
+ * @param "AdditionalMetadata" (optional.String) - Additional data to pass to server
+@return ApiResponse
+*/
+
+type UploadFileWithRequiredFileOpts struct {
+ AdditionalMetadata optional.String
+}
+
+func (a *PetApiService) UploadFileWithRequiredFile(ctx context.Context, petId int64, requiredFile *os.File, localVarOptionals *UploadFileWithRequiredFileOpts) (ApiResponse, *http.Response, error) {
+ var (
+ localVarHttpMethod = http.MethodPost
+ localVarPostBody interface{}
+ localVarFormFileName string
+ localVarFileName string
+ localVarFileBytes []byte
+ localVarReturnValue ApiResponse
+ )
+
+ // create path and map variables
+ localVarPath := a.client.cfg.BasePath + "/fake/{petId}/uploadImageWithRequiredFile"
+ localVarPath = strings.Replace(localVarPath, "{"+"petId"+"}", fmt.Sprintf("%v", petId), -1)
+
+ localVarHeaderParams := make(map[string]string)
+ localVarQueryParams := url.Values{}
+ localVarFormParams := url.Values{}
+
+ // to determine the Content-Type header
+ localVarHttpContentTypes := []string{"multipart/form-data"}
+
+ // set Content-Type header
+ localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
+ if localVarHttpContentType != "" {
+ localVarHeaderParams["Content-Type"] = localVarHttpContentType
+ }
+
+ // to determine the Accept header
+ localVarHttpHeaderAccepts := []string{"application/json"}
+
+ // set Accept header
+ localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
+ if localVarHttpHeaderAccept != "" {
+ localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
+ }
+ if localVarOptionals != nil && localVarOptionals.AdditionalMetadata.IsSet() {
+ localVarFormParams.Add("additionalMetadata", parameterToString(localVarOptionals.AdditionalMetadata.Value(), ""))
+ }
+ localVarFormFileName = "requiredFile"
+ localVarFile := requiredFile
+ if localVarFile != nil {
+ fbs, _ := ioutil.ReadAll(localVarFile)
+ localVarFileBytes = fbs
+ localVarFileName = localVarFile.Name()
+ localVarFile.Close()
+ }
+ r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
+ if err != nil {
+ return localVarReturnValue, nil, err
+ }
+
+ localVarHttpResponse, err := a.client.callAPI(r)
+ if err != nil || localVarHttpResponse == nil {
+ return localVarReturnValue, localVarHttpResponse, err
+ }
+
+ localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
+ localVarHttpResponse.Body.Close()
+ if err != nil {
+ return localVarReturnValue, localVarHttpResponse, err
+ }
+
+ if localVarHttpResponse.StatusCode >= 300 {
+ newErr := GenericOpenAPIError{
+ body: localVarBody,
+ error: localVarHttpResponse.Status,
+ }
+ if localVarHttpResponse.StatusCode == 200 {
+ var v ApiResponse
+ err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
+ if err != nil {
+ newErr.error = err.Error()
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+ newErr.model = v
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+
+ err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
+ if err != nil {
+ newErr := GenericOpenAPIError{
+ body: localVarBody,
+ error: err.Error(),
+ }
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+
+ return localVarReturnValue, localVarHttpResponse, nil
+}
diff --git a/samples/client/petstore/go-experimental/go-petstore/api_store.go b/samples/client/petstore/go-experimental/go-petstore/api_store.go
new file mode 100644
index 000000000000..3211860d49c3
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/api_store.go
@@ -0,0 +1,373 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * API version: 1.0.0
+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)
+ */
+
+package petstore
+
+import (
+ "context"
+ "io/ioutil"
+ "net/http"
+ "net/url"
+ "fmt"
+ "strings"
+)
+
+// Linger please
+var (
+ _ context.Context
+)
+
+type StoreApiService service
+
+/*
+StoreApiService Delete purchase order by ID
+For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
+ * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
+ * @param orderId ID of the order that needs to be deleted
+*/
+func (a *StoreApiService) DeleteOrder(ctx context.Context, orderId string) (*http.Response, error) {
+ var (
+ localVarHttpMethod = http.MethodDelete
+ localVarPostBody interface{}
+ localVarFormFileName string
+ localVarFileName string
+ localVarFileBytes []byte
+ )
+
+ // create path and map variables
+ localVarPath := a.client.cfg.BasePath + "/store/order/{order_id}"
+ localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", fmt.Sprintf("%v", orderId), -1)
+
+ localVarHeaderParams := make(map[string]string)
+ localVarQueryParams := url.Values{}
+ localVarFormParams := url.Values{}
+
+ // to determine the Content-Type header
+ localVarHttpContentTypes := []string{}
+
+ // set Content-Type header
+ localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
+ if localVarHttpContentType != "" {
+ localVarHeaderParams["Content-Type"] = localVarHttpContentType
+ }
+
+ // to determine the Accept header
+ localVarHttpHeaderAccepts := []string{}
+
+ // set Accept header
+ localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
+ if localVarHttpHeaderAccept != "" {
+ localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
+ }
+ r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
+ if err != nil {
+ return nil, err
+ }
+
+ localVarHttpResponse, err := a.client.callAPI(r)
+ if err != nil || localVarHttpResponse == nil {
+ return localVarHttpResponse, err
+ }
+
+ localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
+ localVarHttpResponse.Body.Close()
+ if err != nil {
+ return localVarHttpResponse, err
+ }
+
+ if localVarHttpResponse.StatusCode >= 300 {
+ newErr := GenericOpenAPIError{
+ body: localVarBody,
+ error: localVarHttpResponse.Status,
+ }
+ return localVarHttpResponse, newErr
+ }
+
+ return localVarHttpResponse, nil
+}
+
+/*
+StoreApiService Returns pet inventories by status
+Returns a map of status codes to quantities
+ * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
+@return map[string]int32
+*/
+func (a *StoreApiService) GetInventory(ctx context.Context) (map[string]int32, *http.Response, error) {
+ var (
+ localVarHttpMethod = http.MethodGet
+ localVarPostBody interface{}
+ localVarFormFileName string
+ localVarFileName string
+ localVarFileBytes []byte
+ localVarReturnValue map[string]int32
+ )
+
+ // create path and map variables
+ localVarPath := a.client.cfg.BasePath + "/store/inventory"
+
+ localVarHeaderParams := make(map[string]string)
+ localVarQueryParams := url.Values{}
+ localVarFormParams := url.Values{}
+
+ // to determine the Content-Type header
+ localVarHttpContentTypes := []string{}
+
+ // set Content-Type header
+ localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
+ if localVarHttpContentType != "" {
+ localVarHeaderParams["Content-Type"] = localVarHttpContentType
+ }
+
+ // to determine the Accept header
+ localVarHttpHeaderAccepts := []string{"application/json"}
+
+ // set Accept header
+ localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
+ if localVarHttpHeaderAccept != "" {
+ localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
+ }
+ if ctx != nil {
+ // API Key Authentication
+ if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
+ var key string
+ if auth.Prefix != "" {
+ key = auth.Prefix + " " + auth.Key
+ } else {
+ key = auth.Key
+ }
+ localVarHeaderParams["api_key"] = key
+ }
+ }
+ r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
+ if err != nil {
+ return localVarReturnValue, nil, err
+ }
+
+ localVarHttpResponse, err := a.client.callAPI(r)
+ if err != nil || localVarHttpResponse == nil {
+ return localVarReturnValue, localVarHttpResponse, err
+ }
+
+ localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
+ localVarHttpResponse.Body.Close()
+ if err != nil {
+ return localVarReturnValue, localVarHttpResponse, err
+ }
+
+ if localVarHttpResponse.StatusCode >= 300 {
+ newErr := GenericOpenAPIError{
+ body: localVarBody,
+ error: localVarHttpResponse.Status,
+ }
+ if localVarHttpResponse.StatusCode == 200 {
+ var v map[string]int32
+ err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
+ if err != nil {
+ newErr.error = err.Error()
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+ newErr.model = v
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+
+ err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
+ if err != nil {
+ newErr := GenericOpenAPIError{
+ body: localVarBody,
+ error: err.Error(),
+ }
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+
+ return localVarReturnValue, localVarHttpResponse, nil
+}
+
+/*
+StoreApiService Find purchase order by ID
+For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
+ * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
+ * @param orderId ID of pet that needs to be fetched
+@return Order
+*/
+func (a *StoreApiService) GetOrderById(ctx context.Context, orderId int64) (Order, *http.Response, error) {
+ var (
+ localVarHttpMethod = http.MethodGet
+ localVarPostBody interface{}
+ localVarFormFileName string
+ localVarFileName string
+ localVarFileBytes []byte
+ localVarReturnValue Order
+ )
+
+ // create path and map variables
+ localVarPath := a.client.cfg.BasePath + "/store/order/{order_id}"
+ localVarPath = strings.Replace(localVarPath, "{"+"order_id"+"}", fmt.Sprintf("%v", orderId), -1)
+
+ localVarHeaderParams := make(map[string]string)
+ localVarQueryParams := url.Values{}
+ localVarFormParams := url.Values{}
+ if orderId < 1 {
+ return localVarReturnValue, nil, reportError("orderId must be greater than 1")
+ }
+ if orderId > 5 {
+ return localVarReturnValue, nil, reportError("orderId must be less than 5")
+ }
+
+ // to determine the Content-Type header
+ localVarHttpContentTypes := []string{}
+
+ // set Content-Type header
+ localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
+ if localVarHttpContentType != "" {
+ localVarHeaderParams["Content-Type"] = localVarHttpContentType
+ }
+
+ // to determine the Accept header
+ localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
+
+ // set Accept header
+ localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
+ if localVarHttpHeaderAccept != "" {
+ localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
+ }
+ r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
+ if err != nil {
+ return localVarReturnValue, nil, err
+ }
+
+ localVarHttpResponse, err := a.client.callAPI(r)
+ if err != nil || localVarHttpResponse == nil {
+ return localVarReturnValue, localVarHttpResponse, err
+ }
+
+ localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
+ localVarHttpResponse.Body.Close()
+ if err != nil {
+ return localVarReturnValue, localVarHttpResponse, err
+ }
+
+ if localVarHttpResponse.StatusCode >= 300 {
+ newErr := GenericOpenAPIError{
+ body: localVarBody,
+ error: localVarHttpResponse.Status,
+ }
+ if localVarHttpResponse.StatusCode == 200 {
+ var v Order
+ err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
+ if err != nil {
+ newErr.error = err.Error()
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+ newErr.model = v
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+
+ err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
+ if err != nil {
+ newErr := GenericOpenAPIError{
+ body: localVarBody,
+ error: err.Error(),
+ }
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+
+ return localVarReturnValue, localVarHttpResponse, nil
+}
+
+/*
+StoreApiService Place an order for a pet
+ * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
+ * @param body order placed for purchasing the pet
+@return Order
+*/
+func (a *StoreApiService) PlaceOrder(ctx context.Context, body Order) (Order, *http.Response, error) {
+ var (
+ localVarHttpMethod = http.MethodPost
+ localVarPostBody interface{}
+ localVarFormFileName string
+ localVarFileName string
+ localVarFileBytes []byte
+ localVarReturnValue Order
+ )
+
+ // create path and map variables
+ localVarPath := a.client.cfg.BasePath + "/store/order"
+
+ localVarHeaderParams := make(map[string]string)
+ localVarQueryParams := url.Values{}
+ localVarFormParams := url.Values{}
+
+ // to determine the Content-Type header
+ localVarHttpContentTypes := []string{}
+
+ // set Content-Type header
+ localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
+ if localVarHttpContentType != "" {
+ localVarHeaderParams["Content-Type"] = localVarHttpContentType
+ }
+
+ // to determine the Accept header
+ localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
+
+ // set Accept header
+ localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
+ if localVarHttpHeaderAccept != "" {
+ localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
+ }
+ // body params
+ localVarPostBody = &body
+ r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
+ if err != nil {
+ return localVarReturnValue, nil, err
+ }
+
+ localVarHttpResponse, err := a.client.callAPI(r)
+ if err != nil || localVarHttpResponse == nil {
+ return localVarReturnValue, localVarHttpResponse, err
+ }
+
+ localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
+ localVarHttpResponse.Body.Close()
+ if err != nil {
+ return localVarReturnValue, localVarHttpResponse, err
+ }
+
+ if localVarHttpResponse.StatusCode >= 300 {
+ newErr := GenericOpenAPIError{
+ body: localVarBody,
+ error: localVarHttpResponse.Status,
+ }
+ if localVarHttpResponse.StatusCode == 200 {
+ var v Order
+ err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
+ if err != nil {
+ newErr.error = err.Error()
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+ newErr.model = v
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+
+ err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
+ if err != nil {
+ newErr := GenericOpenAPIError{
+ body: localVarBody,
+ error: err.Error(),
+ }
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+
+ return localVarReturnValue, localVarHttpResponse, nil
+}
diff --git a/samples/client/petstore/go-experimental/go-petstore/api_user.go b/samples/client/petstore/go-experimental/go-petstore/api_user.go
new file mode 100644
index 000000000000..6a7d2b1195ae
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/api_user.go
@@ -0,0 +1,605 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * API version: 1.0.0
+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)
+ */
+
+package petstore
+
+import (
+ "context"
+ "io/ioutil"
+ "net/http"
+ "net/url"
+ "fmt"
+ "strings"
+)
+
+// Linger please
+var (
+ _ context.Context
+)
+
+type UserApiService service
+
+/*
+UserApiService Create user
+This can only be done by the logged in user.
+ * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
+ * @param body Created user object
+*/
+func (a *UserApiService) CreateUser(ctx context.Context, body User) (*http.Response, error) {
+ var (
+ localVarHttpMethod = http.MethodPost
+ localVarPostBody interface{}
+ localVarFormFileName string
+ localVarFileName string
+ localVarFileBytes []byte
+ )
+
+ // create path and map variables
+ localVarPath := a.client.cfg.BasePath + "/user"
+
+ localVarHeaderParams := make(map[string]string)
+ localVarQueryParams := url.Values{}
+ localVarFormParams := url.Values{}
+
+ // to determine the Content-Type header
+ localVarHttpContentTypes := []string{}
+
+ // set Content-Type header
+ localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
+ if localVarHttpContentType != "" {
+ localVarHeaderParams["Content-Type"] = localVarHttpContentType
+ }
+
+ // to determine the Accept header
+ localVarHttpHeaderAccepts := []string{}
+
+ // set Accept header
+ localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
+ if localVarHttpHeaderAccept != "" {
+ localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
+ }
+ // body params
+ localVarPostBody = &body
+ r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
+ if err != nil {
+ return nil, err
+ }
+
+ localVarHttpResponse, err := a.client.callAPI(r)
+ if err != nil || localVarHttpResponse == nil {
+ return localVarHttpResponse, err
+ }
+
+ localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
+ localVarHttpResponse.Body.Close()
+ if err != nil {
+ return localVarHttpResponse, err
+ }
+
+ if localVarHttpResponse.StatusCode >= 300 {
+ newErr := GenericOpenAPIError{
+ body: localVarBody,
+ error: localVarHttpResponse.Status,
+ }
+ return localVarHttpResponse, newErr
+ }
+
+ return localVarHttpResponse, nil
+}
+
+/*
+UserApiService Creates list of users with given input array
+ * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
+ * @param body List of user object
+*/
+func (a *UserApiService) CreateUsersWithArrayInput(ctx context.Context, body []User) (*http.Response, error) {
+ var (
+ localVarHttpMethod = http.MethodPost
+ localVarPostBody interface{}
+ localVarFormFileName string
+ localVarFileName string
+ localVarFileBytes []byte
+ )
+
+ // create path and map variables
+ localVarPath := a.client.cfg.BasePath + "/user/createWithArray"
+
+ localVarHeaderParams := make(map[string]string)
+ localVarQueryParams := url.Values{}
+ localVarFormParams := url.Values{}
+
+ // to determine the Content-Type header
+ localVarHttpContentTypes := []string{}
+
+ // set Content-Type header
+ localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
+ if localVarHttpContentType != "" {
+ localVarHeaderParams["Content-Type"] = localVarHttpContentType
+ }
+
+ // to determine the Accept header
+ localVarHttpHeaderAccepts := []string{}
+
+ // set Accept header
+ localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
+ if localVarHttpHeaderAccept != "" {
+ localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
+ }
+ // body params
+ localVarPostBody = &body
+ r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
+ if err != nil {
+ return nil, err
+ }
+
+ localVarHttpResponse, err := a.client.callAPI(r)
+ if err != nil || localVarHttpResponse == nil {
+ return localVarHttpResponse, err
+ }
+
+ localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
+ localVarHttpResponse.Body.Close()
+ if err != nil {
+ return localVarHttpResponse, err
+ }
+
+ if localVarHttpResponse.StatusCode >= 300 {
+ newErr := GenericOpenAPIError{
+ body: localVarBody,
+ error: localVarHttpResponse.Status,
+ }
+ return localVarHttpResponse, newErr
+ }
+
+ return localVarHttpResponse, nil
+}
+
+/*
+UserApiService Creates list of users with given input array
+ * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
+ * @param body List of user object
+*/
+func (a *UserApiService) CreateUsersWithListInput(ctx context.Context, body []User) (*http.Response, error) {
+ var (
+ localVarHttpMethod = http.MethodPost
+ localVarPostBody interface{}
+ localVarFormFileName string
+ localVarFileName string
+ localVarFileBytes []byte
+ )
+
+ // create path and map variables
+ localVarPath := a.client.cfg.BasePath + "/user/createWithList"
+
+ localVarHeaderParams := make(map[string]string)
+ localVarQueryParams := url.Values{}
+ localVarFormParams := url.Values{}
+
+ // to determine the Content-Type header
+ localVarHttpContentTypes := []string{}
+
+ // set Content-Type header
+ localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
+ if localVarHttpContentType != "" {
+ localVarHeaderParams["Content-Type"] = localVarHttpContentType
+ }
+
+ // to determine the Accept header
+ localVarHttpHeaderAccepts := []string{}
+
+ // set Accept header
+ localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
+ if localVarHttpHeaderAccept != "" {
+ localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
+ }
+ // body params
+ localVarPostBody = &body
+ r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
+ if err != nil {
+ return nil, err
+ }
+
+ localVarHttpResponse, err := a.client.callAPI(r)
+ if err != nil || localVarHttpResponse == nil {
+ return localVarHttpResponse, err
+ }
+
+ localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
+ localVarHttpResponse.Body.Close()
+ if err != nil {
+ return localVarHttpResponse, err
+ }
+
+ if localVarHttpResponse.StatusCode >= 300 {
+ newErr := GenericOpenAPIError{
+ body: localVarBody,
+ error: localVarHttpResponse.Status,
+ }
+ return localVarHttpResponse, newErr
+ }
+
+ return localVarHttpResponse, nil
+}
+
+/*
+UserApiService Delete user
+This can only be done by the logged in user.
+ * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
+ * @param username The name that needs to be deleted
+*/
+func (a *UserApiService) DeleteUser(ctx context.Context, username string) (*http.Response, error) {
+ var (
+ localVarHttpMethod = http.MethodDelete
+ localVarPostBody interface{}
+ localVarFormFileName string
+ localVarFileName string
+ localVarFileBytes []byte
+ )
+
+ // create path and map variables
+ localVarPath := a.client.cfg.BasePath + "/user/{username}"
+ localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1)
+
+ localVarHeaderParams := make(map[string]string)
+ localVarQueryParams := url.Values{}
+ localVarFormParams := url.Values{}
+
+ // to determine the Content-Type header
+ localVarHttpContentTypes := []string{}
+
+ // set Content-Type header
+ localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
+ if localVarHttpContentType != "" {
+ localVarHeaderParams["Content-Type"] = localVarHttpContentType
+ }
+
+ // to determine the Accept header
+ localVarHttpHeaderAccepts := []string{}
+
+ // set Accept header
+ localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
+ if localVarHttpHeaderAccept != "" {
+ localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
+ }
+ r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
+ if err != nil {
+ return nil, err
+ }
+
+ localVarHttpResponse, err := a.client.callAPI(r)
+ if err != nil || localVarHttpResponse == nil {
+ return localVarHttpResponse, err
+ }
+
+ localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
+ localVarHttpResponse.Body.Close()
+ if err != nil {
+ return localVarHttpResponse, err
+ }
+
+ if localVarHttpResponse.StatusCode >= 300 {
+ newErr := GenericOpenAPIError{
+ body: localVarBody,
+ error: localVarHttpResponse.Status,
+ }
+ return localVarHttpResponse, newErr
+ }
+
+ return localVarHttpResponse, nil
+}
+
+/*
+UserApiService Get user by user name
+ * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
+ * @param username The name that needs to be fetched. Use user1 for testing.
+@return User
+*/
+func (a *UserApiService) GetUserByName(ctx context.Context, username string) (User, *http.Response, error) {
+ var (
+ localVarHttpMethod = http.MethodGet
+ localVarPostBody interface{}
+ localVarFormFileName string
+ localVarFileName string
+ localVarFileBytes []byte
+ localVarReturnValue User
+ )
+
+ // create path and map variables
+ localVarPath := a.client.cfg.BasePath + "/user/{username}"
+ localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1)
+
+ localVarHeaderParams := make(map[string]string)
+ localVarQueryParams := url.Values{}
+ localVarFormParams := url.Values{}
+
+ // to determine the Content-Type header
+ localVarHttpContentTypes := []string{}
+
+ // set Content-Type header
+ localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
+ if localVarHttpContentType != "" {
+ localVarHeaderParams["Content-Type"] = localVarHttpContentType
+ }
+
+ // to determine the Accept header
+ localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
+
+ // set Accept header
+ localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
+ if localVarHttpHeaderAccept != "" {
+ localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
+ }
+ r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
+ if err != nil {
+ return localVarReturnValue, nil, err
+ }
+
+ localVarHttpResponse, err := a.client.callAPI(r)
+ if err != nil || localVarHttpResponse == nil {
+ return localVarReturnValue, localVarHttpResponse, err
+ }
+
+ localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
+ localVarHttpResponse.Body.Close()
+ if err != nil {
+ return localVarReturnValue, localVarHttpResponse, err
+ }
+
+ if localVarHttpResponse.StatusCode >= 300 {
+ newErr := GenericOpenAPIError{
+ body: localVarBody,
+ error: localVarHttpResponse.Status,
+ }
+ if localVarHttpResponse.StatusCode == 200 {
+ var v User
+ err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
+ if err != nil {
+ newErr.error = err.Error()
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+ newErr.model = v
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+
+ err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
+ if err != nil {
+ newErr := GenericOpenAPIError{
+ body: localVarBody,
+ error: err.Error(),
+ }
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+
+ return localVarReturnValue, localVarHttpResponse, nil
+}
+
+/*
+UserApiService Logs user into the system
+ * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
+ * @param username The user name for login
+ * @param password The password for login in clear text
+@return string
+*/
+func (a *UserApiService) LoginUser(ctx context.Context, username string, password string) (string, *http.Response, error) {
+ var (
+ localVarHttpMethod = http.MethodGet
+ localVarPostBody interface{}
+ localVarFormFileName string
+ localVarFileName string
+ localVarFileBytes []byte
+ localVarReturnValue string
+ )
+
+ // create path and map variables
+ localVarPath := a.client.cfg.BasePath + "/user/login"
+
+ localVarHeaderParams := make(map[string]string)
+ localVarQueryParams := url.Values{}
+ localVarFormParams := url.Values{}
+
+ localVarQueryParams.Add("username", parameterToString(username, ""))
+ localVarQueryParams.Add("password", parameterToString(password, ""))
+ // to determine the Content-Type header
+ localVarHttpContentTypes := []string{}
+
+ // set Content-Type header
+ localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
+ if localVarHttpContentType != "" {
+ localVarHeaderParams["Content-Type"] = localVarHttpContentType
+ }
+
+ // to determine the Accept header
+ localVarHttpHeaderAccepts := []string{"application/xml", "application/json"}
+
+ // set Accept header
+ localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
+ if localVarHttpHeaderAccept != "" {
+ localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
+ }
+ r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
+ if err != nil {
+ return localVarReturnValue, nil, err
+ }
+
+ localVarHttpResponse, err := a.client.callAPI(r)
+ if err != nil || localVarHttpResponse == nil {
+ return localVarReturnValue, localVarHttpResponse, err
+ }
+
+ localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
+ localVarHttpResponse.Body.Close()
+ if err != nil {
+ return localVarReturnValue, localVarHttpResponse, err
+ }
+
+ if localVarHttpResponse.StatusCode >= 300 {
+ newErr := GenericOpenAPIError{
+ body: localVarBody,
+ error: localVarHttpResponse.Status,
+ }
+ if localVarHttpResponse.StatusCode == 200 {
+ var v string
+ err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
+ if err != nil {
+ newErr.error = err.Error()
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+ newErr.model = v
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+
+ err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
+ if err != nil {
+ newErr := GenericOpenAPIError{
+ body: localVarBody,
+ error: err.Error(),
+ }
+ return localVarReturnValue, localVarHttpResponse, newErr
+ }
+
+ return localVarReturnValue, localVarHttpResponse, nil
+}
+
+/*
+UserApiService Logs out current logged in user session
+ * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
+*/
+func (a *UserApiService) LogoutUser(ctx context.Context) (*http.Response, error) {
+ var (
+ localVarHttpMethod = http.MethodGet
+ localVarPostBody interface{}
+ localVarFormFileName string
+ localVarFileName string
+ localVarFileBytes []byte
+ )
+
+ // create path and map variables
+ localVarPath := a.client.cfg.BasePath + "/user/logout"
+
+ localVarHeaderParams := make(map[string]string)
+ localVarQueryParams := url.Values{}
+ localVarFormParams := url.Values{}
+
+ // to determine the Content-Type header
+ localVarHttpContentTypes := []string{}
+
+ // set Content-Type header
+ localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
+ if localVarHttpContentType != "" {
+ localVarHeaderParams["Content-Type"] = localVarHttpContentType
+ }
+
+ // to determine the Accept header
+ localVarHttpHeaderAccepts := []string{}
+
+ // set Accept header
+ localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
+ if localVarHttpHeaderAccept != "" {
+ localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
+ }
+ r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
+ if err != nil {
+ return nil, err
+ }
+
+ localVarHttpResponse, err := a.client.callAPI(r)
+ if err != nil || localVarHttpResponse == nil {
+ return localVarHttpResponse, err
+ }
+
+ localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
+ localVarHttpResponse.Body.Close()
+ if err != nil {
+ return localVarHttpResponse, err
+ }
+
+ if localVarHttpResponse.StatusCode >= 300 {
+ newErr := GenericOpenAPIError{
+ body: localVarBody,
+ error: localVarHttpResponse.Status,
+ }
+ return localVarHttpResponse, newErr
+ }
+
+ return localVarHttpResponse, nil
+}
+
+/*
+UserApiService Updated user
+This can only be done by the logged in user.
+ * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
+ * @param username name that need to be deleted
+ * @param body Updated user object
+*/
+func (a *UserApiService) UpdateUser(ctx context.Context, username string, body User) (*http.Response, error) {
+ var (
+ localVarHttpMethod = http.MethodPut
+ localVarPostBody interface{}
+ localVarFormFileName string
+ localVarFileName string
+ localVarFileBytes []byte
+ )
+
+ // create path and map variables
+ localVarPath := a.client.cfg.BasePath + "/user/{username}"
+ localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", fmt.Sprintf("%v", username), -1)
+
+ localVarHeaderParams := make(map[string]string)
+ localVarQueryParams := url.Values{}
+ localVarFormParams := url.Values{}
+
+ // to determine the Content-Type header
+ localVarHttpContentTypes := []string{}
+
+ // set Content-Type header
+ localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
+ if localVarHttpContentType != "" {
+ localVarHeaderParams["Content-Type"] = localVarHttpContentType
+ }
+
+ // to determine the Accept header
+ localVarHttpHeaderAccepts := []string{}
+
+ // set Accept header
+ localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
+ if localVarHttpHeaderAccept != "" {
+ localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
+ }
+ // body params
+ localVarPostBody = &body
+ r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
+ if err != nil {
+ return nil, err
+ }
+
+ localVarHttpResponse, err := a.client.callAPI(r)
+ if err != nil || localVarHttpResponse == nil {
+ return localVarHttpResponse, err
+ }
+
+ localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
+ localVarHttpResponse.Body.Close()
+ if err != nil {
+ return localVarHttpResponse, err
+ }
+
+ if localVarHttpResponse.StatusCode >= 300 {
+ newErr := GenericOpenAPIError{
+ body: localVarBody,
+ error: localVarHttpResponse.Status,
+ }
+ return localVarHttpResponse, newErr
+ }
+
+ return localVarHttpResponse, nil
+}
diff --git a/samples/client/petstore/go-experimental/go-petstore/client.go b/samples/client/petstore/go-experimental/go-petstore/client.go
new file mode 100644
index 000000000000..79a128973d9f
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/client.go
@@ -0,0 +1,514 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * API version: 1.0.0
+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)
+ */
+
+package petstore
+
+import (
+ "bytes"
+ "context"
+ "encoding/json"
+ "encoding/xml"
+ "errors"
+ "fmt"
+ "io"
+ "mime/multipart"
+ "net/http"
+ "net/url"
+ "os"
+ "path/filepath"
+ "reflect"
+ "regexp"
+ "strconv"
+ "strings"
+ "time"
+ "unicode/utf8"
+
+ "golang.org/x/oauth2"
+)
+
+var (
+ jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`)
+ xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`)
+)
+
+// APIClient manages communication with the OpenAPI Petstore API v1.0.0
+// In most cases there should be only one, shared, APIClient.
+type APIClient struct {
+ cfg *Configuration
+ common service // Reuse a single struct instead of allocating one for each service on the heap.
+
+ // API Services
+
+ AnotherFakeApi *AnotherFakeApiService
+
+ FakeApi *FakeApiService
+
+ FakeClassnameTags123Api *FakeClassnameTags123ApiService
+
+ PetApi *PetApiService
+
+ StoreApi *StoreApiService
+
+ UserApi *UserApiService
+}
+
+type service struct {
+ client *APIClient
+}
+
+// NewAPIClient creates a new API client. Requires a userAgent string describing your application.
+// optionally a custom http.Client to allow for advanced features such as caching.
+func NewAPIClient(cfg *Configuration) *APIClient {
+ if cfg.HTTPClient == nil {
+ cfg.HTTPClient = http.DefaultClient
+ }
+
+ c := &APIClient{}
+ c.cfg = cfg
+ c.common.client = c
+
+ // API Services
+ c.AnotherFakeApi = (*AnotherFakeApiService)(&c.common)
+ c.FakeApi = (*FakeApiService)(&c.common)
+ c.FakeClassnameTags123Api = (*FakeClassnameTags123ApiService)(&c.common)
+ c.PetApi = (*PetApiService)(&c.common)
+ c.StoreApi = (*StoreApiService)(&c.common)
+ c.UserApi = (*UserApiService)(&c.common)
+
+ return c
+}
+
+func atoi(in string) (int, error) {
+ return strconv.Atoi(in)
+}
+
+// selectHeaderContentType select a content type from the available list.
+func selectHeaderContentType(contentTypes []string) string {
+ if len(contentTypes) == 0 {
+ return ""
+ }
+ if contains(contentTypes, "application/json") {
+ return "application/json"
+ }
+ return contentTypes[0] // use the first content type specified in 'consumes'
+}
+
+// selectHeaderAccept join all accept types and return
+func selectHeaderAccept(accepts []string) string {
+ if len(accepts) == 0 {
+ return ""
+ }
+
+ if contains(accepts, "application/json") {
+ return "application/json"
+ }
+
+ return strings.Join(accepts, ",")
+}
+
+// contains is a case insenstive match, finding needle in a haystack
+func contains(haystack []string, needle string) bool {
+ for _, a := range haystack {
+ if strings.ToLower(a) == strings.ToLower(needle) {
+ return true
+ }
+ }
+ return false
+}
+
+// Verify optional parameters are of the correct type.
+func typeCheckParameter(obj interface{}, expected string, name string) error {
+ // Make sure there is an object.
+ if obj == nil {
+ return nil
+ }
+
+ // Check the type is as expected.
+ if reflect.TypeOf(obj).String() != expected {
+ return fmt.Errorf("Expected %s to be of type %s but received %s.", name, expected, reflect.TypeOf(obj).String())
+ }
+ return nil
+}
+
+// parameterToString convert interface{} parameters to string, using a delimiter if format is provided.
+func parameterToString(obj interface{}, collectionFormat string) string {
+ var delimiter string
+
+ switch collectionFormat {
+ case "pipes":
+ delimiter = "|"
+ case "ssv":
+ delimiter = " "
+ case "tsv":
+ delimiter = "\t"
+ case "csv":
+ delimiter = ","
+ }
+
+ if reflect.TypeOf(obj).Kind() == reflect.Slice {
+ return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]")
+ } else if t, ok := obj.(time.Time); ok {
+ return t.Format(time.RFC3339)
+ }
+
+ return fmt.Sprintf("%v", obj)
+}
+
+// helper for converting interface{} parameters to json strings
+func parameterToJson(obj interface{}) (string, error) {
+ jsonBuf, err := json.Marshal(obj)
+ if err != nil {
+ return "", err
+ }
+ return string(jsonBuf), err
+}
+
+
+// callAPI do the request.
+func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) {
+ return c.cfg.HTTPClient.Do(request)
+}
+
+// Change base path to allow switching to mocks
+func (c *APIClient) ChangeBasePath(path string) {
+ c.cfg.BasePath = path
+}
+
+// prepareRequest build the request
+func (c *APIClient) prepareRequest(
+ ctx context.Context,
+ path string, method string,
+ postBody interface{},
+ headerParams map[string]string,
+ queryParams url.Values,
+ formParams url.Values,
+ formFileName string,
+ fileName string,
+ fileBytes []byte) (localVarRequest *http.Request, err error) {
+
+ var body *bytes.Buffer
+
+ // Detect postBody type and post.
+ if postBody != nil {
+ contentType := headerParams["Content-Type"]
+ if contentType == "" {
+ contentType = detectContentType(postBody)
+ headerParams["Content-Type"] = contentType
+ }
+
+ body, err = setBody(postBody, contentType)
+ if err != nil {
+ return nil, err
+ }
+ }
+
+ // add form parameters and file if available.
+ if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(fileBytes) > 0 && fileName != "") {
+ if body != nil {
+ return nil, errors.New("Cannot specify postBody and multipart form at the same time.")
+ }
+ body = &bytes.Buffer{}
+ w := multipart.NewWriter(body)
+
+ for k, v := range formParams {
+ for _, iv := range v {
+ if strings.HasPrefix(k, "@") { // file
+ err = addFile(w, k[1:], iv)
+ if err != nil {
+ return nil, err
+ }
+ } else { // form value
+ w.WriteField(k, iv)
+ }
+ }
+ }
+ if len(fileBytes) > 0 && fileName != "" {
+ w.Boundary()
+ //_, fileNm := filepath.Split(fileName)
+ part, err := w.CreateFormFile(formFileName, filepath.Base(fileName))
+ if err != nil {
+ return nil, err
+ }
+ _, err = part.Write(fileBytes)
+ if err != nil {
+ return nil, err
+ }
+ }
+
+ // Set the Boundary in the Content-Type
+ headerParams["Content-Type"] = w.FormDataContentType()
+
+ // Set Content-Length
+ headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len())
+ w.Close()
+ }
+
+ if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 {
+ if body != nil {
+ return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.")
+ }
+ body = &bytes.Buffer{}
+ body.WriteString(formParams.Encode())
+ // Set Content-Length
+ headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len())
+ }
+
+ // Setup path and query parameters
+ url, err := url.Parse(path)
+ if err != nil {
+ return nil, err
+ }
+
+ // Override request host, if applicable
+ if c.cfg.Host != "" {
+ url.Host = c.cfg.Host
+ }
+
+ // Override request scheme, if applicable
+ if c.cfg.Scheme != "" {
+ url.Scheme = c.cfg.Scheme
+ }
+
+ // Adding Query Param
+ query := url.Query()
+ for k, v := range queryParams {
+ for _, iv := range v {
+ query.Add(k, iv)
+ }
+ }
+
+ // Encode the parameters.
+ url.RawQuery = query.Encode()
+
+ // Generate a new request
+ if body != nil {
+ localVarRequest, err = http.NewRequest(method, url.String(), body)
+ } else {
+ localVarRequest, err = http.NewRequest(method, url.String(), nil)
+ }
+ if err != nil {
+ return nil, err
+ }
+
+ // add header parameters, if any
+ if len(headerParams) > 0 {
+ headers := http.Header{}
+ for h, v := range headerParams {
+ headers.Set(h, v)
+ }
+ localVarRequest.Header = headers
+ }
+
+ // Add the user agent to the request.
+ localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent)
+
+ if ctx != nil {
+ // add context to the request
+ localVarRequest = localVarRequest.WithContext(ctx)
+
+ // Walk through any authentication.
+
+ // OAuth2 authentication
+ if tok, ok := ctx.Value(ContextOAuth2).(oauth2.TokenSource); ok {
+ // We were able to grab an oauth2 token from the context
+ var latestToken *oauth2.Token
+ if latestToken, err = tok.Token(); err != nil {
+ return nil, err
+ }
+
+ latestToken.SetAuthHeader(localVarRequest)
+ }
+
+ // Basic HTTP Authentication
+ if auth, ok := ctx.Value(ContextBasicAuth).(BasicAuth); ok {
+ localVarRequest.SetBasicAuth(auth.UserName, auth.Password)
+ }
+
+ // AccessToken Authentication
+ if auth, ok := ctx.Value(ContextAccessToken).(string); ok {
+ localVarRequest.Header.Add("Authorization", "Bearer "+auth)
+ }
+ }
+
+ for header, value := range c.cfg.DefaultHeader {
+ localVarRequest.Header.Add(header, value)
+ }
+
+ return localVarRequest, nil
+}
+
+func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) {
+ if s, ok := v.(*string); ok {
+ *s = string(b)
+ return nil
+ }
+ if xmlCheck.MatchString(contentType) {
+ if err = xml.Unmarshal(b, v); err != nil {
+ return err
+ }
+ return nil
+ }
+ if jsonCheck.MatchString(contentType) {
+ if err = json.Unmarshal(b, v); err != nil {
+ return err
+ }
+ return nil
+ }
+ return errors.New("undefined response type")
+}
+
+// Add a file to the multipart request
+func addFile(w *multipart.Writer, fieldName, path string) error {
+ file, err := os.Open(path)
+ if err != nil {
+ return err
+ }
+ defer file.Close()
+
+ part, err := w.CreateFormFile(fieldName, filepath.Base(path))
+ if err != nil {
+ return err
+ }
+ _, err = io.Copy(part, file)
+
+ return err
+}
+
+// Prevent trying to import "fmt"
+func reportError(format string, a ...interface{}) error {
+ return fmt.Errorf(format, a...)
+}
+
+// Set request body from an interface{}
+func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) {
+ if bodyBuf == nil {
+ bodyBuf = &bytes.Buffer{}
+ }
+
+ if reader, ok := body.(io.Reader); ok {
+ _, err = bodyBuf.ReadFrom(reader)
+ } else if b, ok := body.([]byte); ok {
+ _, err = bodyBuf.Write(b)
+ } else if s, ok := body.(string); ok {
+ _, err = bodyBuf.WriteString(s)
+ } else if s, ok := body.(*string); ok {
+ _, err = bodyBuf.WriteString(*s)
+ } else if jsonCheck.MatchString(contentType) {
+ err = json.NewEncoder(bodyBuf).Encode(body)
+ } else if xmlCheck.MatchString(contentType) {
+ err = xml.NewEncoder(bodyBuf).Encode(body)
+ }
+
+ if err != nil {
+ return nil, err
+ }
+
+ if bodyBuf.Len() == 0 {
+ err = fmt.Errorf("Invalid body type %s\n", contentType)
+ return nil, err
+ }
+ return bodyBuf, nil
+}
+
+// detectContentType method is used to figure out `Request.Body` content type for request header
+func detectContentType(body interface{}) string {
+ contentType := "text/plain; charset=utf-8"
+ kind := reflect.TypeOf(body).Kind()
+
+ switch kind {
+ case reflect.Struct, reflect.Map, reflect.Ptr:
+ contentType = "application/json; charset=utf-8"
+ case reflect.String:
+ contentType = "text/plain; charset=utf-8"
+ default:
+ if b, ok := body.([]byte); ok {
+ contentType = http.DetectContentType(b)
+ } else if kind == reflect.Slice {
+ contentType = "application/json; charset=utf-8"
+ }
+ }
+
+ return contentType
+}
+
+// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go
+type cacheControl map[string]string
+
+func parseCacheControl(headers http.Header) cacheControl {
+ cc := cacheControl{}
+ ccHeader := headers.Get("Cache-Control")
+ for _, part := range strings.Split(ccHeader, ",") {
+ part = strings.Trim(part, " ")
+ if part == "" {
+ continue
+ }
+ if strings.ContainsRune(part, '=') {
+ keyval := strings.Split(part, "=")
+ cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",")
+ } else {
+ cc[part] = ""
+ }
+ }
+ return cc
+}
+
+// CacheExpires helper function to determine remaining time before repeating a request.
+func CacheExpires(r *http.Response) time.Time {
+ // Figure out when the cache expires.
+ var expires time.Time
+ now, err := time.Parse(time.RFC1123, r.Header.Get("date"))
+ if err != nil {
+ return time.Now()
+ }
+ respCacheControl := parseCacheControl(r.Header)
+
+ if maxAge, ok := respCacheControl["max-age"]; ok {
+ lifetime, err := time.ParseDuration(maxAge + "s")
+ if err != nil {
+ expires = now
+ } else {
+ expires = now.Add(lifetime)
+ }
+ } else {
+ expiresHeader := r.Header.Get("Expires")
+ if expiresHeader != "" {
+ expires, err = time.Parse(time.RFC1123, expiresHeader)
+ if err != nil {
+ expires = now
+ }
+ }
+ }
+ return expires
+}
+
+func strlen(s string) int {
+ return utf8.RuneCountInString(s)
+}
+
+// GenericOpenAPIError Provides access to the body, error and model on returned errors.
+type GenericOpenAPIError struct {
+ body []byte
+ error string
+ model interface{}
+}
+
+// Error returns non-empty string if there was an error.
+func (e GenericOpenAPIError) Error() string {
+ return e.error
+}
+
+// Body returns the raw bytes of the response
+func (e GenericOpenAPIError) Body() []byte {
+ return e.body
+}
+
+// Model returns the unpacked model of the error
+func (e GenericOpenAPIError) Model() interface{} {
+ return e.model
+}
diff --git a/samples/client/petstore/go-experimental/go-petstore/configuration.go b/samples/client/petstore/go-experimental/go-petstore/configuration.go
new file mode 100644
index 000000000000..19ccc325fa92
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/configuration.go
@@ -0,0 +1,72 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * API version: 1.0.0
+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)
+ */
+
+package petstore
+
+import (
+ "net/http"
+)
+
+// contextKeys are used to identify the type of value in the context.
+// Since these are string, it is possible to get a short description of the
+// context key for logging and debugging using key.String().
+
+type contextKey string
+
+func (c contextKey) String() string {
+ return "auth " + string(c)
+}
+
+var (
+ // ContextOAuth2 takes an oauth2.TokenSource as authentication for the request.
+ ContextOAuth2 = contextKey("token")
+
+ // ContextBasicAuth takes BasicAuth as authentication for the request.
+ ContextBasicAuth = contextKey("basic")
+
+ // ContextAccessToken takes a string oauth2 access token as authentication for the request.
+ ContextAccessToken = contextKey("accesstoken")
+
+ // ContextAPIKey takes an APIKey as authentication for the request
+ ContextAPIKey = contextKey("apikey")
+)
+
+// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth
+type BasicAuth struct {
+ UserName string `json:"userName,omitempty"`
+ Password string `json:"password,omitempty"`
+}
+
+// APIKey provides API key based authentication to a request passed via context using ContextAPIKey
+type APIKey struct {
+ Key string
+ Prefix string
+}
+
+type Configuration struct {
+ BasePath string `json:"basePath,omitempty"`
+ Host string `json:"host,omitempty"`
+ Scheme string `json:"scheme,omitempty"`
+ DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
+ UserAgent string `json:"userAgent,omitempty"`
+ HTTPClient *http.Client
+}
+
+func NewConfiguration() *Configuration {
+ cfg := &Configuration{
+ BasePath: "http://petstore.swagger.io:80/v2",
+ DefaultHeader: make(map[string]string),
+ UserAgent: "OpenAPI-Generator/1.0.0/go",
+ }
+ return cfg
+}
+
+func (c *Configuration) AddDefaultHeader(key string, value string) {
+ c.DefaultHeader[key] = value
+}
diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/AdditionalPropertiesAnyType.md b/samples/client/petstore/go-experimental/go-petstore/docs/AdditionalPropertiesAnyType.md
new file mode 100644
index 000000000000..eadec3142ce8
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/docs/AdditionalPropertiesAnyType.md
@@ -0,0 +1,11 @@
+# AdditionalPropertiesAnyType
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**Name** | **string** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/AdditionalPropertiesArray.md b/samples/client/petstore/go-experimental/go-petstore/docs/AdditionalPropertiesArray.md
new file mode 100644
index 000000000000..0c37598aeb2c
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/docs/AdditionalPropertiesArray.md
@@ -0,0 +1,11 @@
+# AdditionalPropertiesArray
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**Name** | **string** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/AdditionalPropertiesBoolean.md b/samples/client/petstore/go-experimental/go-petstore/docs/AdditionalPropertiesBoolean.md
new file mode 100644
index 000000000000..7190fe8429b8
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/docs/AdditionalPropertiesBoolean.md
@@ -0,0 +1,11 @@
+# AdditionalPropertiesBoolean
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**Name** | **string** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/AdditionalPropertiesClass.md b/samples/client/petstore/go-experimental/go-petstore/docs/AdditionalPropertiesClass.md
new file mode 100644
index 000000000000..877a5d45a316
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/docs/AdditionalPropertiesClass.md
@@ -0,0 +1,21 @@
+# AdditionalPropertiesClass
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**MapString** | **map[string]string** | | [optional]
+**MapNumber** | **map[string]float32** | | [optional]
+**MapInteger** | **map[string]int32** | | [optional]
+**MapBoolean** | **map[string]bool** | | [optional]
+**MapArrayInteger** | [**map[string][]int32**](array.md) | | [optional]
+**MapArrayAnytype** | [**map[string][]map[string]interface{}**](array.md) | | [optional]
+**MapMapString** | [**map[string]map[string]string**](map.md) | | [optional]
+**MapMapAnytype** | [**map[string]map[string]map[string]interface{}**](map.md) | | [optional]
+**Anytype1** | [**map[string]interface{}**](.md) | | [optional]
+**Anytype2** | [**map[string]interface{}**](.md) | | [optional]
+**Anytype3** | [**map[string]interface{}**](.md) | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/AdditionalPropertiesInteger.md b/samples/client/petstore/go-experimental/go-petstore/docs/AdditionalPropertiesInteger.md
new file mode 100644
index 000000000000..34e6fca8fb00
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/docs/AdditionalPropertiesInteger.md
@@ -0,0 +1,11 @@
+# AdditionalPropertiesInteger
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**Name** | **string** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/AdditionalPropertiesNumber.md b/samples/client/petstore/go-experimental/go-petstore/docs/AdditionalPropertiesNumber.md
new file mode 100644
index 000000000000..6d41fd2315c7
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/docs/AdditionalPropertiesNumber.md
@@ -0,0 +1,11 @@
+# AdditionalPropertiesNumber
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**Name** | **string** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/AdditionalPropertiesObject.md b/samples/client/petstore/go-experimental/go-petstore/docs/AdditionalPropertiesObject.md
new file mode 100644
index 000000000000..b856de693b16
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/docs/AdditionalPropertiesObject.md
@@ -0,0 +1,11 @@
+# AdditionalPropertiesObject
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**Name** | **string** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/AdditionalPropertiesString.md b/samples/client/petstore/go-experimental/go-petstore/docs/AdditionalPropertiesString.md
new file mode 100644
index 000000000000..69ad20656858
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/docs/AdditionalPropertiesString.md
@@ -0,0 +1,11 @@
+# AdditionalPropertiesString
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**Name** | **string** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/Animal.md b/samples/client/petstore/go-experimental/go-petstore/docs/Animal.md
new file mode 100644
index 000000000000..02d23377da6d
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/docs/Animal.md
@@ -0,0 +1,12 @@
+# Animal
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**ClassName** | **string** | |
+**Color** | **string** | | [optional] [default to red]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/AnotherFakeApi.md b/samples/client/petstore/go-experimental/go-petstore/docs/AnotherFakeApi.md
new file mode 100644
index 000000000000..0b9deb0c58a5
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/docs/AnotherFakeApi.md
@@ -0,0 +1,42 @@
+# \AnotherFakeApi
+
+All URIs are relative to *http://petstore.swagger.io:80/v2*
+
+Method | HTTP request | Description
+------------- | ------------- | -------------
+[**Call123TestSpecialTags**](AnotherFakeApi.md#Call123TestSpecialTags) | **Patch** /another-fake/dummy | To test special tags
+
+
+
+## Call123TestSpecialTags
+
+> Client Call123TestSpecialTags(ctx, body)
+To test special tags
+
+To test special tags and operation ID starting with number
+
+### Required Parameters
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
+**body** | [**Client**](Client.md)| client model |
+
+### Return type
+
+[**Client**](Client.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: application/json
+- **Accept**: application/json
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
+[[Back to Model list]](../README.md#documentation-for-models)
+[[Back to README]](../README.md)
+
diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/ApiResponse.md b/samples/client/petstore/go-experimental/go-petstore/docs/ApiResponse.md
new file mode 100644
index 000000000000..41d28fb578c1
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/docs/ApiResponse.md
@@ -0,0 +1,13 @@
+# ApiResponse
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**Code** | **int32** | | [optional]
+**Type** | **string** | | [optional]
+**Message** | **string** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/ArrayOfArrayOfNumberOnly.md b/samples/client/petstore/go-experimental/go-petstore/docs/ArrayOfArrayOfNumberOnly.md
new file mode 100644
index 000000000000..555213013b20
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/docs/ArrayOfArrayOfNumberOnly.md
@@ -0,0 +1,11 @@
+# ArrayOfArrayOfNumberOnly
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**ArrayArrayNumber** | [**[][]float32**](array.md) | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/ArrayOfNumberOnly.md b/samples/client/petstore/go-experimental/go-petstore/docs/ArrayOfNumberOnly.md
new file mode 100644
index 000000000000..56618756dd77
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/docs/ArrayOfNumberOnly.md
@@ -0,0 +1,11 @@
+# ArrayOfNumberOnly
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**ArrayNumber** | **[]float32** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/ArrayTest.md b/samples/client/petstore/go-experimental/go-petstore/docs/ArrayTest.md
new file mode 100644
index 000000000000..0da0bc52d2d3
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/docs/ArrayTest.md
@@ -0,0 +1,13 @@
+# ArrayTest
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**ArrayOfString** | **[]string** | | [optional]
+**ArrayArrayOfInteger** | [**[][]int64**](array.md) | | [optional]
+**ArrayArrayOfModel** | [**[][]ReadOnlyFirst**](array.md) | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/Capitalization.md b/samples/client/petstore/go-experimental/go-petstore/docs/Capitalization.md
new file mode 100644
index 000000000000..426b8eabd9bd
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/docs/Capitalization.md
@@ -0,0 +1,16 @@
+# Capitalization
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**SmallCamel** | **string** | | [optional]
+**CapitalCamel** | **string** | | [optional]
+**SmallSnake** | **string** | | [optional]
+**CapitalSnake** | **string** | | [optional]
+**SCAETHFlowPoints** | **string** | | [optional]
+**ATT_NAME** | **string** | Name of the pet | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/Cat.md b/samples/client/petstore/go-experimental/go-petstore/docs/Cat.md
new file mode 100644
index 000000000000..1ef1f095e947
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/docs/Cat.md
@@ -0,0 +1,13 @@
+# Cat
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**ClassName** | **string** | |
+**Color** | **string** | | [optional] [default to red]
+**Declawed** | **bool** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/CatAllOf.md b/samples/client/petstore/go-experimental/go-petstore/docs/CatAllOf.md
new file mode 100644
index 000000000000..c978cee0417f
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/docs/CatAllOf.md
@@ -0,0 +1,11 @@
+# CatAllOf
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**Declawed** | **bool** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/Category.md b/samples/client/petstore/go-experimental/go-petstore/docs/Category.md
new file mode 100644
index 000000000000..01e8344bd06f
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/docs/Category.md
@@ -0,0 +1,12 @@
+# Category
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**Id** | **int64** | | [optional]
+**Name** | **string** | | [default to default-name]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/ClassModel.md b/samples/client/petstore/go-experimental/go-petstore/docs/ClassModel.md
new file mode 100644
index 000000000000..0b925cebb1f6
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/docs/ClassModel.md
@@ -0,0 +1,11 @@
+# ClassModel
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**Class** | **string** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/Client.md b/samples/client/petstore/go-experimental/go-petstore/docs/Client.md
new file mode 100644
index 000000000000..551da852eece
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/docs/Client.md
@@ -0,0 +1,11 @@
+# Client
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**Client** | **string** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/Dog.md b/samples/client/petstore/go-experimental/go-petstore/docs/Dog.md
new file mode 100644
index 000000000000..ff35dd5cdca2
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/docs/Dog.md
@@ -0,0 +1,13 @@
+# Dog
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**ClassName** | **string** | |
+**Color** | **string** | | [optional] [default to red]
+**Breed** | **string** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/DogAllOf.md b/samples/client/petstore/go-experimental/go-petstore/docs/DogAllOf.md
new file mode 100644
index 000000000000..b87153e92652
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/docs/DogAllOf.md
@@ -0,0 +1,11 @@
+# DogAllOf
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**Breed** | **string** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/EnumArrays.md b/samples/client/petstore/go-experimental/go-petstore/docs/EnumArrays.md
new file mode 100644
index 000000000000..3021f8818307
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/docs/EnumArrays.md
@@ -0,0 +1,12 @@
+# EnumArrays
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**JustSymbol** | **string** | | [optional]
+**ArrayEnum** | **[]string** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/EnumClass.md b/samples/client/petstore/go-experimental/go-petstore/docs/EnumClass.md
new file mode 100644
index 000000000000..c6932388c067
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/docs/EnumClass.md
@@ -0,0 +1,10 @@
+# EnumClass
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/EnumTest.md b/samples/client/petstore/go-experimental/go-petstore/docs/EnumTest.md
new file mode 100644
index 000000000000..eeec09b66b4f
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/docs/EnumTest.md
@@ -0,0 +1,15 @@
+# EnumTest
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**EnumString** | **string** | | [optional]
+**EnumStringRequired** | **string** | |
+**EnumInteger** | **int32** | | [optional]
+**EnumNumber** | **float64** | | [optional]
+**OuterEnum** | [**OuterEnum**](OuterEnum.md) | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/FakeApi.md b/samples/client/petstore/go-experimental/go-petstore/docs/FakeApi.md
new file mode 100644
index 000000000000..b7927f181e40
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/docs/FakeApi.md
@@ -0,0 +1,541 @@
+# \FakeApi
+
+All URIs are relative to *http://petstore.swagger.io:80/v2*
+
+Method | HTTP request | Description
+------------- | ------------- | -------------
+[**CreateXmlItem**](FakeApi.md#CreateXmlItem) | **Post** /fake/create_xml_item | creates an XmlItem
+[**FakeOuterBooleanSerialize**](FakeApi.md#FakeOuterBooleanSerialize) | **Post** /fake/outer/boolean |
+[**FakeOuterCompositeSerialize**](FakeApi.md#FakeOuterCompositeSerialize) | **Post** /fake/outer/composite |
+[**FakeOuterNumberSerialize**](FakeApi.md#FakeOuterNumberSerialize) | **Post** /fake/outer/number |
+[**FakeOuterStringSerialize**](FakeApi.md#FakeOuterStringSerialize) | **Post** /fake/outer/string |
+[**TestBodyWithFileSchema**](FakeApi.md#TestBodyWithFileSchema) | **Put** /fake/body-with-file-schema |
+[**TestBodyWithQueryParams**](FakeApi.md#TestBodyWithQueryParams) | **Put** /fake/body-with-query-params |
+[**TestClientModel**](FakeApi.md#TestClientModel) | **Patch** /fake | To test \"client\" model
+[**TestEndpointParameters**](FakeApi.md#TestEndpointParameters) | **Post** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
+[**TestEnumParameters**](FakeApi.md#TestEnumParameters) | **Get** /fake | To test enum parameters
+[**TestGroupParameters**](FakeApi.md#TestGroupParameters) | **Delete** /fake | Fake endpoint to test group parameters (optional)
+[**TestInlineAdditionalProperties**](FakeApi.md#TestInlineAdditionalProperties) | **Post** /fake/inline-additionalProperties | test inline additionalProperties
+[**TestJsonFormData**](FakeApi.md#TestJsonFormData) | **Get** /fake/jsonFormData | test json serialization of form data
+
+
+
+## CreateXmlItem
+
+> CreateXmlItem(ctx, xmlItem)
+creates an XmlItem
+
+this route creates an XmlItem
+
+### Required Parameters
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
+**xmlItem** | [**XmlItem**](XmlItem.md)| XmlItem Body |
+
+### Return type
+
+ (empty response body)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: application/xml, application/xml; charset=utf-8, application/xml; charset=utf-16, text/xml, text/xml; charset=utf-8, text/xml; charset=utf-16
+- **Accept**: Not defined
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
+[[Back to Model list]](../README.md#documentation-for-models)
+[[Back to README]](../README.md)
+
+
+## FakeOuterBooleanSerialize
+
+> bool FakeOuterBooleanSerialize(ctx, optional)
+
+
+Test serialization of outer boolean types
+
+### Required Parameters
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
+ **optional** | ***FakeOuterBooleanSerializeOpts** | optional parameters | nil if no parameters
+
+### Optional Parameters
+
+Optional parameters are passed through a pointer to a FakeOuterBooleanSerializeOpts struct
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **body** | **optional.Bool**| Input boolean as post body |
+
+### Return type
+
+**bool**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: */*
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
+[[Back to Model list]](../README.md#documentation-for-models)
+[[Back to README]](../README.md)
+
+
+## FakeOuterCompositeSerialize
+
+> OuterComposite FakeOuterCompositeSerialize(ctx, optional)
+
+
+Test serialization of object with outer number type
+
+### Required Parameters
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
+ **optional** | ***FakeOuterCompositeSerializeOpts** | optional parameters | nil if no parameters
+
+### Optional Parameters
+
+Optional parameters are passed through a pointer to a FakeOuterCompositeSerializeOpts struct
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **body** | [**optional.Interface of OuterComposite**](OuterComposite.md)| Input composite as post body |
+
+### Return type
+
+[**OuterComposite**](OuterComposite.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: */*
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
+[[Back to Model list]](../README.md#documentation-for-models)
+[[Back to README]](../README.md)
+
+
+## FakeOuterNumberSerialize
+
+> float32 FakeOuterNumberSerialize(ctx, optional)
+
+
+Test serialization of outer number types
+
+### Required Parameters
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
+ **optional** | ***FakeOuterNumberSerializeOpts** | optional parameters | nil if no parameters
+
+### Optional Parameters
+
+Optional parameters are passed through a pointer to a FakeOuterNumberSerializeOpts struct
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **body** | **optional.Float32**| Input number as post body |
+
+### Return type
+
+**float32**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: */*
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
+[[Back to Model list]](../README.md#documentation-for-models)
+[[Back to README]](../README.md)
+
+
+## FakeOuterStringSerialize
+
+> string FakeOuterStringSerialize(ctx, optional)
+
+
+Test serialization of outer string types
+
+### Required Parameters
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
+ **optional** | ***FakeOuterStringSerializeOpts** | optional parameters | nil if no parameters
+
+### Optional Parameters
+
+Optional parameters are passed through a pointer to a FakeOuterStringSerializeOpts struct
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **body** | **optional.String**| Input string as post body |
+
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: */*
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
+[[Back to Model list]](../README.md#documentation-for-models)
+[[Back to README]](../README.md)
+
+
+## TestBodyWithFileSchema
+
+> TestBodyWithFileSchema(ctx, body)
+
+
+For this test, the body for this request much reference a schema named `File`.
+
+### Required Parameters
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
+**body** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| |
+
+### Return type
+
+ (empty response body)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: application/json
+- **Accept**: Not defined
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
+[[Back to Model list]](../README.md#documentation-for-models)
+[[Back to README]](../README.md)
+
+
+## TestBodyWithQueryParams
+
+> TestBodyWithQueryParams(ctx, query, body)
+
+
+### Required Parameters
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
+**query** | **string**| |
+**body** | [**User**](User.md)| |
+
+### Return type
+
+ (empty response body)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: application/json
+- **Accept**: Not defined
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
+[[Back to Model list]](../README.md#documentation-for-models)
+[[Back to README]](../README.md)
+
+
+## TestClientModel
+
+> Client TestClientModel(ctx, body)
+To test \"client\" model
+
+To test \"client\" model
+
+### Required Parameters
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
+**body** | [**Client**](Client.md)| client model |
+
+### Return type
+
+[**Client**](Client.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: application/json
+- **Accept**: application/json
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
+[[Back to Model list]](../README.md#documentation-for-models)
+[[Back to README]](../README.md)
+
+
+## TestEndpointParameters
+
+> TestEndpointParameters(ctx, number, double, patternWithoutDelimiter, byte_, optional)
+Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
+
+Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
+
+### Required Parameters
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
+**number** | **float32**| None |
+**double** | **float64**| None |
+**patternWithoutDelimiter** | **string**| None |
+**byte_** | **string**| None |
+ **optional** | ***TestEndpointParametersOpts** | optional parameters | nil if no parameters
+
+### Optional Parameters
+
+Optional parameters are passed through a pointer to a TestEndpointParametersOpts struct
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+
+
+
+
+ **integer** | **optional.Int32**| None |
+ **int32_** | **optional.Int32**| None |
+ **int64_** | **optional.Int64**| None |
+ **float** | **optional.Float32**| None |
+ **string_** | **optional.String**| None |
+ **binary** | **optional.Interface of *os.File****optional.*os.File**| None |
+ **date** | **optional.String**| None |
+ **dateTime** | **optional.Time**| None |
+ **password** | **optional.String**| None |
+ **callback** | **optional.String**| None |
+
+### Return type
+
+ (empty response body)
+
+### Authorization
+
+[http_basic_test](../README.md#http_basic_test)
+
+### HTTP request headers
+
+- **Content-Type**: application/x-www-form-urlencoded
+- **Accept**: Not defined
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
+[[Back to Model list]](../README.md#documentation-for-models)
+[[Back to README]](../README.md)
+
+
+## TestEnumParameters
+
+> TestEnumParameters(ctx, optional)
+To test enum parameters
+
+To test enum parameters
+
+### Required Parameters
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
+ **optional** | ***TestEnumParametersOpts** | optional parameters | nil if no parameters
+
+### Optional Parameters
+
+Optional parameters are passed through a pointer to a TestEnumParametersOpts struct
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **enumHeaderStringArray** | [**optional.Interface of []string**](string.md)| Header parameter enum test (string array) |
+ **enumHeaderString** | **optional.String**| Header parameter enum test (string) | [default to -efg]
+ **enumQueryStringArray** | [**optional.Interface of []string**](string.md)| Query parameter enum test (string array) |
+ **enumQueryString** | **optional.String**| Query parameter enum test (string) | [default to -efg]
+ **enumQueryInteger** | **optional.Int32**| Query parameter enum test (double) |
+ **enumQueryDouble** | **optional.Float64**| Query parameter enum test (double) |
+ **enumFormStringArray** | [**optional.Interface of []string**](string.md)| Form parameter enum test (string array) | [default to $]
+ **enumFormString** | **optional.String**| Form parameter enum test (string) | [default to -efg]
+
+### Return type
+
+ (empty response body)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: application/x-www-form-urlencoded
+- **Accept**: Not defined
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
+[[Back to Model list]](../README.md#documentation-for-models)
+[[Back to README]](../README.md)
+
+
+## TestGroupParameters
+
+> TestGroupParameters(ctx, requiredStringGroup, requiredBooleanGroup, requiredInt64Group, optional)
+Fake endpoint to test group parameters (optional)
+
+Fake endpoint to test group parameters (optional)
+
+### Required Parameters
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
+**requiredStringGroup** | **int32**| Required String in group parameters |
+**requiredBooleanGroup** | **bool**| Required Boolean in group parameters |
+**requiredInt64Group** | **int64**| Required Integer in group parameters |
+ **optional** | ***TestGroupParametersOpts** | optional parameters | nil if no parameters
+
+### Optional Parameters
+
+Optional parameters are passed through a pointer to a TestGroupParametersOpts struct
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+
+
+
+ **stringGroup** | **optional.Int32**| String in group parameters |
+ **booleanGroup** | **optional.Bool**| Boolean in group parameters |
+ **int64Group** | **optional.Int64**| Integer in group parameters |
+
+### Return type
+
+ (empty response body)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: Not defined
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
+[[Back to Model list]](../README.md#documentation-for-models)
+[[Back to README]](../README.md)
+
+
+## TestInlineAdditionalProperties
+
+> TestInlineAdditionalProperties(ctx, param)
+test inline additionalProperties
+
+### Required Parameters
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
+**param** | [**map[string]string**](string.md)| request body |
+
+### Return type
+
+ (empty response body)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: application/json
+- **Accept**: Not defined
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
+[[Back to Model list]](../README.md#documentation-for-models)
+[[Back to README]](../README.md)
+
+
+## TestJsonFormData
+
+> TestJsonFormData(ctx, param, param2)
+test json serialization of form data
+
+### Required Parameters
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
+**param** | **string**| field1 |
+**param2** | **string**| field2 |
+
+### Return type
+
+ (empty response body)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: application/x-www-form-urlencoded
+- **Accept**: Not defined
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
+[[Back to Model list]](../README.md#documentation-for-models)
+[[Back to README]](../README.md)
+
diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/FakeClassnameTags123Api.md b/samples/client/petstore/go-experimental/go-petstore/docs/FakeClassnameTags123Api.md
new file mode 100644
index 000000000000..b3cbcc2c06e1
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/docs/FakeClassnameTags123Api.md
@@ -0,0 +1,42 @@
+# \FakeClassnameTags123Api
+
+All URIs are relative to *http://petstore.swagger.io:80/v2*
+
+Method | HTTP request | Description
+------------- | ------------- | -------------
+[**TestClassname**](FakeClassnameTags123Api.md#TestClassname) | **Patch** /fake_classname_test | To test class name in snake case
+
+
+
+## TestClassname
+
+> Client TestClassname(ctx, body)
+To test class name in snake case
+
+To test class name in snake case
+
+### Required Parameters
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
+**body** | [**Client**](Client.md)| client model |
+
+### Return type
+
+[**Client**](Client.md)
+
+### Authorization
+
+[api_key_query](../README.md#api_key_query)
+
+### HTTP request headers
+
+- **Content-Type**: application/json
+- **Accept**: application/json
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
+[[Back to Model list]](../README.md#documentation-for-models)
+[[Back to README]](../README.md)
+
diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/File.md b/samples/client/petstore/go-experimental/go-petstore/docs/File.md
new file mode 100644
index 000000000000..a113b0312cdf
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/docs/File.md
@@ -0,0 +1,11 @@
+# File
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**SourceURI** | **string** | Test capitalization | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/FileSchemaTestClass.md b/samples/client/petstore/go-experimental/go-petstore/docs/FileSchemaTestClass.md
new file mode 100644
index 000000000000..ae51414dd6cc
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/docs/FileSchemaTestClass.md
@@ -0,0 +1,12 @@
+# FileSchemaTestClass
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**File** | [**File**](File.md) | | [optional]
+**Files** | [**[]File**](File.md) | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/FormatTest.md b/samples/client/petstore/go-experimental/go-petstore/docs/FormatTest.md
new file mode 100644
index 000000000000..ee089a03cd79
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/docs/FormatTest.md
@@ -0,0 +1,23 @@
+# FormatTest
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**Integer** | **int32** | | [optional]
+**Int32** | **int32** | | [optional]
+**Int64** | **int64** | | [optional]
+**Number** | **float32** | |
+**Float** | **float32** | | [optional]
+**Double** | **float64** | | [optional]
+**String** | **string** | | [optional]
+**Byte** | **string** | |
+**Binary** | [***os.File**](*os.File.md) | | [optional]
+**Date** | **string** | |
+**DateTime** | [**time.Time**](time.Time.md) | | [optional]
+**Uuid** | **string** | | [optional]
+**Password** | **string** | |
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/HasOnlyReadOnly.md b/samples/client/petstore/go-experimental/go-petstore/docs/HasOnlyReadOnly.md
new file mode 100644
index 000000000000..9e2f49573597
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/docs/HasOnlyReadOnly.md
@@ -0,0 +1,12 @@
+# HasOnlyReadOnly
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**Bar** | **string** | | [optional]
+**Foo** | **string** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/List.md b/samples/client/petstore/go-experimental/go-petstore/docs/List.md
new file mode 100644
index 000000000000..bba2e5299066
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/docs/List.md
@@ -0,0 +1,11 @@
+# List
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**Var123List** | **string** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/MapTest.md b/samples/client/petstore/go-experimental/go-petstore/docs/MapTest.md
new file mode 100644
index 000000000000..6645e044658d
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/docs/MapTest.md
@@ -0,0 +1,14 @@
+# MapTest
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**MapMapOfString** | [**map[string]map[string]string**](map.md) | | [optional]
+**MapOfEnumString** | **map[string]string** | | [optional]
+**DirectMap** | **map[string]bool** | | [optional]
+**IndirectMap** | **map[string]bool** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/client/petstore/go-experimental/go-petstore/docs/MixedPropertiesAndAdditionalPropertiesClass.md
new file mode 100644
index 000000000000..a2ce1068b279
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/docs/MixedPropertiesAndAdditionalPropertiesClass.md
@@ -0,0 +1,13 @@
+# MixedPropertiesAndAdditionalPropertiesClass
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**Uuid** | **string** | | [optional]
+**DateTime** | [**time.Time**](time.Time.md) | | [optional]
+**Map** | [**map[string]Animal**](Animal.md) | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/Model200Response.md b/samples/client/petstore/go-experimental/go-petstore/docs/Model200Response.md
new file mode 100644
index 000000000000..27b93bd1549f
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/docs/Model200Response.md
@@ -0,0 +1,12 @@
+# Model200Response
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**Name** | **int32** | | [optional]
+**Class** | **string** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/Name.md b/samples/client/petstore/go-experimental/go-petstore/docs/Name.md
new file mode 100644
index 000000000000..453e54d98516
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/docs/Name.md
@@ -0,0 +1,14 @@
+# Name
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**Name** | **int32** | |
+**SnakeCase** | **int32** | | [optional]
+**Property** | **string** | | [optional]
+**Var123Number** | **int32** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/NumberOnly.md b/samples/client/petstore/go-experimental/go-petstore/docs/NumberOnly.md
new file mode 100644
index 000000000000..604cf37eeded
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/docs/NumberOnly.md
@@ -0,0 +1,11 @@
+# NumberOnly
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**JustNumber** | **float32** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/Order.md b/samples/client/petstore/go-experimental/go-petstore/docs/Order.md
new file mode 100644
index 000000000000..eeef0971005e
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/docs/Order.md
@@ -0,0 +1,16 @@
+# Order
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**Id** | **int64** | | [optional]
+**PetId** | **int64** | | [optional]
+**Quantity** | **int32** | | [optional]
+**ShipDate** | [**time.Time**](time.Time.md) | | [optional]
+**Status** | **string** | Order Status | [optional]
+**Complete** | **bool** | | [optional] [default to false]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/OuterComposite.md b/samples/client/petstore/go-experimental/go-petstore/docs/OuterComposite.md
new file mode 100644
index 000000000000..df9bce1bd904
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/docs/OuterComposite.md
@@ -0,0 +1,13 @@
+# OuterComposite
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**MyNumber** | **float32** | | [optional]
+**MyString** | **string** | | [optional]
+**MyBoolean** | **bool** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/OuterEnum.md b/samples/client/petstore/go-experimental/go-petstore/docs/OuterEnum.md
new file mode 100644
index 000000000000..c97466159c56
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/docs/OuterEnum.md
@@ -0,0 +1,10 @@
+# OuterEnum
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/Pet.md b/samples/client/petstore/go-experimental/go-petstore/docs/Pet.md
new file mode 100644
index 000000000000..c48104c63971
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/docs/Pet.md
@@ -0,0 +1,16 @@
+# Pet
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**Id** | **int64** | | [optional]
+**Category** | [**Category**](Category.md) | | [optional]
+**Name** | **string** | |
+**PhotoUrls** | **[]string** | |
+**Tags** | [**[]Tag**](Tag.md) | | [optional]
+**Status** | **string** | pet status in the store | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/PetApi.md b/samples/client/petstore/go-experimental/go-petstore/docs/PetApi.md
new file mode 100644
index 000000000000..de48d4b6763c
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/docs/PetApi.md
@@ -0,0 +1,350 @@
+# \PetApi
+
+All URIs are relative to *http://petstore.swagger.io:80/v2*
+
+Method | HTTP request | Description
+------------- | ------------- | -------------
+[**AddPet**](PetApi.md#AddPet) | **Post** /pet | Add a new pet to the store
+[**DeletePet**](PetApi.md#DeletePet) | **Delete** /pet/{petId} | Deletes a pet
+[**FindPetsByStatus**](PetApi.md#FindPetsByStatus) | **Get** /pet/findByStatus | Finds Pets by status
+[**FindPetsByTags**](PetApi.md#FindPetsByTags) | **Get** /pet/findByTags | Finds Pets by tags
+[**GetPetById**](PetApi.md#GetPetById) | **Get** /pet/{petId} | Find pet by ID
+[**UpdatePet**](PetApi.md#UpdatePet) | **Put** /pet | Update an existing pet
+[**UpdatePetWithForm**](PetApi.md#UpdatePetWithForm) | **Post** /pet/{petId} | Updates a pet in the store with form data
+[**UploadFile**](PetApi.md#UploadFile) | **Post** /pet/{petId}/uploadImage | uploads an image
+[**UploadFileWithRequiredFile**](PetApi.md#UploadFileWithRequiredFile) | **Post** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required)
+
+
+
+## AddPet
+
+> AddPet(ctx, body)
+Add a new pet to the store
+
+### Required Parameters
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
+**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
+
+### Return type
+
+ (empty response body)
+
+### Authorization
+
+[petstore_auth](../README.md#petstore_auth)
+
+### HTTP request headers
+
+- **Content-Type**: application/json, application/xml
+- **Accept**: Not defined
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
+[[Back to Model list]](../README.md#documentation-for-models)
+[[Back to README]](../README.md)
+
+
+## DeletePet
+
+> DeletePet(ctx, petId, optional)
+Deletes a pet
+
+### Required Parameters
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
+**petId** | **int64**| Pet id to delete |
+ **optional** | ***DeletePetOpts** | optional parameters | nil if no parameters
+
+### Optional Parameters
+
+Optional parameters are passed through a pointer to a DeletePetOpts struct
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+
+ **apiKey** | **optional.String**| |
+
+### Return type
+
+ (empty response body)
+
+### Authorization
+
+[petstore_auth](../README.md#petstore_auth)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: Not defined
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
+[[Back to Model list]](../README.md#documentation-for-models)
+[[Back to README]](../README.md)
+
+
+## FindPetsByStatus
+
+> []Pet FindPetsByStatus(ctx, status)
+Finds Pets by status
+
+Multiple status values can be provided with comma separated strings
+
+### Required Parameters
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
+**status** | [**[]string**](string.md)| Status values that need to be considered for filter |
+
+### Return type
+
+[**[]Pet**](Pet.md)
+
+### Authorization
+
+[petstore_auth](../README.md#petstore_auth)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: application/xml, application/json
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
+[[Back to Model list]](../README.md#documentation-for-models)
+[[Back to README]](../README.md)
+
+
+## FindPetsByTags
+
+> []Pet FindPetsByTags(ctx, tags)
+Finds Pets by tags
+
+Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
+
+### Required Parameters
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
+**tags** | [**[]string**](string.md)| Tags to filter by |
+
+### Return type
+
+[**[]Pet**](Pet.md)
+
+### Authorization
+
+[petstore_auth](../README.md#petstore_auth)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: application/xml, application/json
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
+[[Back to Model list]](../README.md#documentation-for-models)
+[[Back to README]](../README.md)
+
+
+## GetPetById
+
+> Pet GetPetById(ctx, petId)
+Find pet by ID
+
+Returns a single pet
+
+### Required Parameters
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
+**petId** | **int64**| ID of pet to return |
+
+### Return type
+
+[**Pet**](Pet.md)
+
+### Authorization
+
+[api_key](../README.md#api_key)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: application/xml, application/json
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
+[[Back to Model list]](../README.md#documentation-for-models)
+[[Back to README]](../README.md)
+
+
+## UpdatePet
+
+> UpdatePet(ctx, body)
+Update an existing pet
+
+### Required Parameters
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
+**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
+
+### Return type
+
+ (empty response body)
+
+### Authorization
+
+[petstore_auth](../README.md#petstore_auth)
+
+### HTTP request headers
+
+- **Content-Type**: application/json, application/xml
+- **Accept**: Not defined
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
+[[Back to Model list]](../README.md#documentation-for-models)
+[[Back to README]](../README.md)
+
+
+## UpdatePetWithForm
+
+> UpdatePetWithForm(ctx, petId, optional)
+Updates a pet in the store with form data
+
+### Required Parameters
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
+**petId** | **int64**| ID of pet that needs to be updated |
+ **optional** | ***UpdatePetWithFormOpts** | optional parameters | nil if no parameters
+
+### Optional Parameters
+
+Optional parameters are passed through a pointer to a UpdatePetWithFormOpts struct
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+
+ **name** | **optional.String**| Updated name of the pet |
+ **status** | **optional.String**| Updated status of the pet |
+
+### Return type
+
+ (empty response body)
+
+### Authorization
+
+[petstore_auth](../README.md#petstore_auth)
+
+### HTTP request headers
+
+- **Content-Type**: application/x-www-form-urlencoded
+- **Accept**: Not defined
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
+[[Back to Model list]](../README.md#documentation-for-models)
+[[Back to README]](../README.md)
+
+
+## UploadFile
+
+> ApiResponse UploadFile(ctx, petId, optional)
+uploads an image
+
+### Required Parameters
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
+**petId** | **int64**| ID of pet to update |
+ **optional** | ***UploadFileOpts** | optional parameters | nil if no parameters
+
+### Optional Parameters
+
+Optional parameters are passed through a pointer to a UploadFileOpts struct
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+
+ **additionalMetadata** | **optional.String**| Additional data to pass to server |
+ **file** | **optional.Interface of *os.File****optional.*os.File**| file to upload |
+
+### Return type
+
+[**ApiResponse**](ApiResponse.md)
+
+### Authorization
+
+[petstore_auth](../README.md#petstore_auth)
+
+### HTTP request headers
+
+- **Content-Type**: multipart/form-data
+- **Accept**: application/json
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
+[[Back to Model list]](../README.md#documentation-for-models)
+[[Back to README]](../README.md)
+
+
+## UploadFileWithRequiredFile
+
+> ApiResponse UploadFileWithRequiredFile(ctx, petId, requiredFile, optional)
+uploads an image (required)
+
+### Required Parameters
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
+**petId** | **int64**| ID of pet to update |
+**requiredFile** | ***os.File*****os.File**| file to upload |
+ **optional** | ***UploadFileWithRequiredFileOpts** | optional parameters | nil if no parameters
+
+### Optional Parameters
+
+Optional parameters are passed through a pointer to a UploadFileWithRequiredFileOpts struct
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+
+
+ **additionalMetadata** | **optional.String**| Additional data to pass to server |
+
+### Return type
+
+[**ApiResponse**](ApiResponse.md)
+
+### Authorization
+
+[petstore_auth](../README.md#petstore_auth)
+
+### HTTP request headers
+
+- **Content-Type**: multipart/form-data
+- **Accept**: application/json
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
+[[Back to Model list]](../README.md#documentation-for-models)
+[[Back to README]](../README.md)
+
diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/ReadOnlyFirst.md b/samples/client/petstore/go-experimental/go-petstore/docs/ReadOnlyFirst.md
new file mode 100644
index 000000000000..3fee799f2951
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/docs/ReadOnlyFirst.md
@@ -0,0 +1,12 @@
+# ReadOnlyFirst
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**Bar** | **string** | | [optional]
+**Baz** | **string** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/Return.md b/samples/client/petstore/go-experimental/go-petstore/docs/Return.md
new file mode 100644
index 000000000000..11be0b27c503
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/docs/Return.md
@@ -0,0 +1,11 @@
+# Return
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**Return** | **int32** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/SpecialModelName.md b/samples/client/petstore/go-experimental/go-petstore/docs/SpecialModelName.md
new file mode 100644
index 000000000000..96d7a28a409a
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/docs/SpecialModelName.md
@@ -0,0 +1,11 @@
+# SpecialModelName
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**SpecialPropertyName** | **int64** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/StoreApi.md b/samples/client/petstore/go-experimental/go-petstore/docs/StoreApi.md
new file mode 100644
index 000000000000..083ed777590f
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/docs/StoreApi.md
@@ -0,0 +1,138 @@
+# \StoreApi
+
+All URIs are relative to *http://petstore.swagger.io:80/v2*
+
+Method | HTTP request | Description
+------------- | ------------- | -------------
+[**DeleteOrder**](StoreApi.md#DeleteOrder) | **Delete** /store/order/{order_id} | Delete purchase order by ID
+[**GetInventory**](StoreApi.md#GetInventory) | **Get** /store/inventory | Returns pet inventories by status
+[**GetOrderById**](StoreApi.md#GetOrderById) | **Get** /store/order/{order_id} | Find purchase order by ID
+[**PlaceOrder**](StoreApi.md#PlaceOrder) | **Post** /store/order | Place an order for a pet
+
+
+
+## DeleteOrder
+
+> DeleteOrder(ctx, orderId)
+Delete purchase order by ID
+
+For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
+
+### Required Parameters
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
+**orderId** | **string**| ID of the order that needs to be deleted |
+
+### Return type
+
+ (empty response body)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: Not defined
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
+[[Back to Model list]](../README.md#documentation-for-models)
+[[Back to README]](../README.md)
+
+
+## GetInventory
+
+> map[string]int32 GetInventory(ctx, )
+Returns pet inventories by status
+
+Returns a map of status codes to quantities
+
+### Required Parameters
+
+This endpoint does not need any parameter.
+
+### Return type
+
+**map[string]int32**
+
+### Authorization
+
+[api_key](../README.md#api_key)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: application/json
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
+[[Back to Model list]](../README.md#documentation-for-models)
+[[Back to README]](../README.md)
+
+
+## GetOrderById
+
+> Order GetOrderById(ctx, orderId)
+Find purchase order by ID
+
+For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
+
+### Required Parameters
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
+**orderId** | **int64**| ID of pet that needs to be fetched |
+
+### Return type
+
+[**Order**](Order.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: application/xml, application/json
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
+[[Back to Model list]](../README.md#documentation-for-models)
+[[Back to README]](../README.md)
+
+
+## PlaceOrder
+
+> Order PlaceOrder(ctx, body)
+Place an order for a pet
+
+### Required Parameters
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
+**body** | [**Order**](Order.md)| order placed for purchasing the pet |
+
+### Return type
+
+[**Order**](Order.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: application/xml, application/json
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
+[[Back to Model list]](../README.md#documentation-for-models)
+[[Back to README]](../README.md)
+
diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/Tag.md b/samples/client/petstore/go-experimental/go-petstore/docs/Tag.md
new file mode 100644
index 000000000000..d6b3cc117b52
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/docs/Tag.md
@@ -0,0 +1,12 @@
+# Tag
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**Id** | **int64** | | [optional]
+**Name** | **string** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/TypeHolderDefault.md b/samples/client/petstore/go-experimental/go-petstore/docs/TypeHolderDefault.md
new file mode 100644
index 000000000000..1b9f077c303b
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/docs/TypeHolderDefault.md
@@ -0,0 +1,15 @@
+# TypeHolderDefault
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**StringItem** | **string** | | [default to what]
+**NumberItem** | **float32** | |
+**IntegerItem** | **int32** | |
+**BoolItem** | **bool** | | [default to true]
+**ArrayItem** | **[]int32** | |
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/TypeHolderExample.md b/samples/client/petstore/go-experimental/go-petstore/docs/TypeHolderExample.md
new file mode 100644
index 000000000000..abe85f9799d1
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/docs/TypeHolderExample.md
@@ -0,0 +1,15 @@
+# TypeHolderExample
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**StringItem** | **string** | |
+**NumberItem** | **float32** | |
+**IntegerItem** | **int32** | |
+**BoolItem** | **bool** | |
+**ArrayItem** | **[]int32** | |
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/User.md b/samples/client/petstore/go-experimental/go-petstore/docs/User.md
new file mode 100644
index 000000000000..7675d7ff701b
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/docs/User.md
@@ -0,0 +1,18 @@
+# User
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**Id** | **int64** | | [optional]
+**Username** | **string** | | [optional]
+**FirstName** | **string** | | [optional]
+**LastName** | **string** | | [optional]
+**Email** | **string** | | [optional]
+**Password** | **string** | | [optional]
+**Phone** | **string** | | [optional]
+**UserStatus** | **int32** | User Status | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/UserApi.md b/samples/client/petstore/go-experimental/go-petstore/docs/UserApi.md
new file mode 100644
index 000000000000..3201e1771dc8
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/docs/UserApi.md
@@ -0,0 +1,268 @@
+# \UserApi
+
+All URIs are relative to *http://petstore.swagger.io:80/v2*
+
+Method | HTTP request | Description
+------------- | ------------- | -------------
+[**CreateUser**](UserApi.md#CreateUser) | **Post** /user | Create user
+[**CreateUsersWithArrayInput**](UserApi.md#CreateUsersWithArrayInput) | **Post** /user/createWithArray | Creates list of users with given input array
+[**CreateUsersWithListInput**](UserApi.md#CreateUsersWithListInput) | **Post** /user/createWithList | Creates list of users with given input array
+[**DeleteUser**](UserApi.md#DeleteUser) | **Delete** /user/{username} | Delete user
+[**GetUserByName**](UserApi.md#GetUserByName) | **Get** /user/{username} | Get user by user name
+[**LoginUser**](UserApi.md#LoginUser) | **Get** /user/login | Logs user into the system
+[**LogoutUser**](UserApi.md#LogoutUser) | **Get** /user/logout | Logs out current logged in user session
+[**UpdateUser**](UserApi.md#UpdateUser) | **Put** /user/{username} | Updated user
+
+
+
+## CreateUser
+
+> CreateUser(ctx, body)
+Create user
+
+This can only be done by the logged in user.
+
+### Required Parameters
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
+**body** | [**User**](User.md)| Created user object |
+
+### Return type
+
+ (empty response body)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: Not defined
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
+[[Back to Model list]](../README.md#documentation-for-models)
+[[Back to README]](../README.md)
+
+
+## CreateUsersWithArrayInput
+
+> CreateUsersWithArrayInput(ctx, body)
+Creates list of users with given input array
+
+### Required Parameters
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
+**body** | [**[]User**](User.md)| List of user object |
+
+### Return type
+
+ (empty response body)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: Not defined
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
+[[Back to Model list]](../README.md#documentation-for-models)
+[[Back to README]](../README.md)
+
+
+## CreateUsersWithListInput
+
+> CreateUsersWithListInput(ctx, body)
+Creates list of users with given input array
+
+### Required Parameters
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
+**body** | [**[]User**](User.md)| List of user object |
+
+### Return type
+
+ (empty response body)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: Not defined
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
+[[Back to Model list]](../README.md#documentation-for-models)
+[[Back to README]](../README.md)
+
+
+## DeleteUser
+
+> DeleteUser(ctx, username)
+Delete user
+
+This can only be done by the logged in user.
+
+### Required Parameters
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
+**username** | **string**| The name that needs to be deleted |
+
+### Return type
+
+ (empty response body)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: Not defined
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
+[[Back to Model list]](../README.md#documentation-for-models)
+[[Back to README]](../README.md)
+
+
+## GetUserByName
+
+> User GetUserByName(ctx, username)
+Get user by user name
+
+### Required Parameters
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
+**username** | **string**| The name that needs to be fetched. Use user1 for testing. |
+
+### Return type
+
+[**User**](User.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: application/xml, application/json
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
+[[Back to Model list]](../README.md#documentation-for-models)
+[[Back to README]](../README.md)
+
+
+## LoginUser
+
+> string LoginUser(ctx, username, password)
+Logs user into the system
+
+### Required Parameters
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
+**username** | **string**| The user name for login |
+**password** | **string**| The password for login in clear text |
+
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: application/xml, application/json
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
+[[Back to Model list]](../README.md#documentation-for-models)
+[[Back to README]](../README.md)
+
+
+## LogoutUser
+
+> LogoutUser(ctx, )
+Logs out current logged in user session
+
+### Required Parameters
+
+This endpoint does not need any parameter.
+
+### Return type
+
+ (empty response body)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: Not defined
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
+[[Back to Model list]](../README.md#documentation-for-models)
+[[Back to README]](../README.md)
+
+
+## UpdateUser
+
+> UpdateUser(ctx, username, body)
+Updated user
+
+This can only be done by the logged in user.
+
+### Required Parameters
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
+**username** | **string**| name that need to be deleted |
+**body** | [**User**](User.md)| Updated user object |
+
+### Return type
+
+ (empty response body)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: Not defined
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
+[[Back to Model list]](../README.md#documentation-for-models)
+[[Back to README]](../README.md)
+
diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/XmlItem.md b/samples/client/petstore/go-experimental/go-petstore/docs/XmlItem.md
new file mode 100644
index 000000000000..8a9c2dc0b504
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/docs/XmlItem.md
@@ -0,0 +1,39 @@
+# XmlItem
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**AttributeString** | **string** | | [optional]
+**AttributeNumber** | **float32** | | [optional]
+**AttributeInteger** | **int32** | | [optional]
+**AttributeBoolean** | **bool** | | [optional]
+**WrappedArray** | **[]int32** | | [optional]
+**NameString** | **string** | | [optional]
+**NameNumber** | **float32** | | [optional]
+**NameInteger** | **int32** | | [optional]
+**NameBoolean** | **bool** | | [optional]
+**NameArray** | **[]int32** | | [optional]
+**NameWrappedArray** | **[]int32** | | [optional]
+**PrefixString** | **string** | | [optional]
+**PrefixNumber** | **float32** | | [optional]
+**PrefixInteger** | **int32** | | [optional]
+**PrefixBoolean** | **bool** | | [optional]
+**PrefixArray** | **[]int32** | | [optional]
+**PrefixWrappedArray** | **[]int32** | | [optional]
+**NamespaceString** | **string** | | [optional]
+**NamespaceNumber** | **float32** | | [optional]
+**NamespaceInteger** | **int32** | | [optional]
+**NamespaceBoolean** | **bool** | | [optional]
+**NamespaceArray** | **[]int32** | | [optional]
+**NamespaceWrappedArray** | **[]int32** | | [optional]
+**PrefixNsString** | **string** | | [optional]
+**PrefixNsNumber** | **float32** | | [optional]
+**PrefixNsInteger** | **int32** | | [optional]
+**PrefixNsBoolean** | **bool** | | [optional]
+**PrefixNsArray** | **[]int32** | | [optional]
+**PrefixNsWrappedArray** | **[]int32** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/go-experimental/go-petstore/git_push.sh b/samples/client/petstore/go-experimental/go-petstore/git_push.sh
new file mode 100644
index 000000000000..8442b80bb445
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/git_push.sh
@@ -0,0 +1,52 @@
+#!/bin/sh
+# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
+#
+# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update"
+
+git_user_id=$1
+git_repo_id=$2
+release_note=$3
+
+if [ "$git_user_id" = "" ]; then
+ git_user_id="GIT_USER_ID"
+ echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
+fi
+
+if [ "$git_repo_id" = "" ]; then
+ git_repo_id="GIT_REPO_ID"
+ echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
+fi
+
+if [ "$release_note" = "" ]; then
+ release_note="Minor update"
+ echo "[INFO] No command line input provided. Set \$release_note to $release_note"
+fi
+
+# Initialize the local directory as a Git repository
+git init
+
+# Adds the files in the local repository and stages them for commit.
+git add .
+
+# Commits the tracked changes and prepares them to be pushed to a remote repository.
+git commit -m "$release_note"
+
+# Sets the new remote
+git_remote=`git remote`
+if [ "$git_remote" = "" ]; then # git remote not defined
+
+ if [ "$GIT_TOKEN" = "" ]; then
+ echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
+ git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
+ else
+ git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
+ fi
+
+fi
+
+git pull origin master
+
+# Pushes (Forces) the changes in the local repository up to the remote repository
+echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
+git push origin master 2>&1 | grep -v 'To https'
+
diff --git a/samples/client/petstore/go-experimental/go-petstore/go.mod b/samples/client/petstore/go-experimental/go-petstore/go.mod
new file mode 100644
index 000000000000..199809ed7066
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/go.mod
@@ -0,0 +1,6 @@
+module github.com/GIT_USER_ID/GIT_REPO_ID
+
+require (
+ github.com/antihax/optional v0.0.0-20180406194304-ca021399b1a6
+ golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a
+)
diff --git a/samples/client/petstore/go-experimental/go-petstore/go.sum b/samples/client/petstore/go-experimental/go-petstore/go.sum
new file mode 100644
index 000000000000..e3c16fef3ac1
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/go.sum
@@ -0,0 +1,11 @@
+cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
+github.com/antihax/optional v0.0.0-20180406194304-ca021399b1a6/go.mod h1:V8iCPQYkqmusNa815XgQio277wI47sdRh1dUOLdyC6Q=
+github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
+golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e h1:bRhVy7zSSasaqNksaRZiA5EEI+Ei4I1nO5Jh72wfHlg=
+golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a h1:tImsplftrFpALCYumobsd0K86vlAs/eXGFms2txfJfA=
+golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
+golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
+google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
diff --git a/samples/client/petstore/go-experimental/go-petstore/model_200_response.go b/samples/client/petstore/go-experimental/go-petstore/model_200_response.go
new file mode 100644
index 000000000000..f918cabaaae2
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/model_200_response.go
@@ -0,0 +1,16 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * API version: 1.0.0
+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)
+ */
+
+package petstore
+
+// Model for testing model name starting with number
+type Model200Response struct {
+ Name int32 `json:"name,omitempty"`
+ Class string `json:"class,omitempty"`
+}
diff --git a/samples/client/petstore/go-experimental/go-petstore/model_additional_properties_any_type.go b/samples/client/petstore/go-experimental/go-petstore/model_additional_properties_any_type.go
new file mode 100644
index 000000000000..ca06584a72f7
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/model_additional_properties_any_type.go
@@ -0,0 +1,14 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * API version: 1.0.0
+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)
+ */
+
+package petstore
+
+type AdditionalPropertiesAnyType struct {
+ Name string `json:"name,omitempty"`
+}
diff --git a/samples/client/petstore/go-experimental/go-petstore/model_additional_properties_array.go b/samples/client/petstore/go-experimental/go-petstore/model_additional_properties_array.go
new file mode 100644
index 000000000000..2e71585506f6
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/model_additional_properties_array.go
@@ -0,0 +1,14 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * API version: 1.0.0
+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)
+ */
+
+package petstore
+
+type AdditionalPropertiesArray struct {
+ Name string `json:"name,omitempty"`
+}
diff --git a/samples/client/petstore/go-experimental/go-petstore/model_additional_properties_boolean.go b/samples/client/petstore/go-experimental/go-petstore/model_additional_properties_boolean.go
new file mode 100644
index 000000000000..09f1ac3b32bc
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/model_additional_properties_boolean.go
@@ -0,0 +1,14 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * API version: 1.0.0
+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)
+ */
+
+package petstore
+
+type AdditionalPropertiesBoolean struct {
+ Name string `json:"name,omitempty"`
+}
diff --git a/samples/client/petstore/go-experimental/go-petstore/model_additional_properties_class.go b/samples/client/petstore/go-experimental/go-petstore/model_additional_properties_class.go
new file mode 100644
index 000000000000..2e1845e194f6
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/model_additional_properties_class.go
@@ -0,0 +1,24 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * API version: 1.0.0
+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)
+ */
+
+package petstore
+
+type AdditionalPropertiesClass struct {
+ MapString map[string]string `json:"map_string,omitempty"`
+ MapNumber map[string]float32 `json:"map_number,omitempty"`
+ MapInteger map[string]int32 `json:"map_integer,omitempty"`
+ MapBoolean map[string]bool `json:"map_boolean,omitempty"`
+ MapArrayInteger map[string][]int32 `json:"map_array_integer,omitempty"`
+ MapArrayAnytype map[string][]map[string]interface{} `json:"map_array_anytype,omitempty"`
+ MapMapString map[string]map[string]string `json:"map_map_string,omitempty"`
+ MapMapAnytype map[string]map[string]map[string]interface{} `json:"map_map_anytype,omitempty"`
+ Anytype1 map[string]interface{} `json:"anytype_1,omitempty"`
+ Anytype2 map[string]interface{} `json:"anytype_2,omitempty"`
+ Anytype3 map[string]interface{} `json:"anytype_3,omitempty"`
+}
diff --git a/samples/client/petstore/go-experimental/go-petstore/model_additional_properties_integer.go b/samples/client/petstore/go-experimental/go-petstore/model_additional_properties_integer.go
new file mode 100644
index 000000000000..2f69fe4b0125
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/model_additional_properties_integer.go
@@ -0,0 +1,14 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * API version: 1.0.0
+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)
+ */
+
+package petstore
+
+type AdditionalPropertiesInteger struct {
+ Name string `json:"name,omitempty"`
+}
diff --git a/samples/client/petstore/go-experimental/go-petstore/model_additional_properties_number.go b/samples/client/petstore/go-experimental/go-petstore/model_additional_properties_number.go
new file mode 100644
index 000000000000..900b2ec32cc9
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/model_additional_properties_number.go
@@ -0,0 +1,14 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * API version: 1.0.0
+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)
+ */
+
+package petstore
+
+type AdditionalPropertiesNumber struct {
+ Name string `json:"name,omitempty"`
+}
diff --git a/samples/client/petstore/go-experimental/go-petstore/model_additional_properties_object.go b/samples/client/petstore/go-experimental/go-petstore/model_additional_properties_object.go
new file mode 100644
index 000000000000..99fa6d02fdcc
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/model_additional_properties_object.go
@@ -0,0 +1,14 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * API version: 1.0.0
+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)
+ */
+
+package petstore
+
+type AdditionalPropertiesObject struct {
+ Name string `json:"name,omitempty"`
+}
diff --git a/samples/client/petstore/go-experimental/go-petstore/model_additional_properties_string.go b/samples/client/petstore/go-experimental/go-petstore/model_additional_properties_string.go
new file mode 100644
index 000000000000..82fe0e4ed30f
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/model_additional_properties_string.go
@@ -0,0 +1,14 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * API version: 1.0.0
+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)
+ */
+
+package petstore
+
+type AdditionalPropertiesString struct {
+ Name string `json:"name,omitempty"`
+}
diff --git a/samples/client/petstore/go-experimental/go-petstore/model_animal.go b/samples/client/petstore/go-experimental/go-petstore/model_animal.go
new file mode 100644
index 000000000000..39d0d2d1ec32
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/model_animal.go
@@ -0,0 +1,15 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * API version: 1.0.0
+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)
+ */
+
+package petstore
+
+type Animal struct {
+ ClassName string `json:"className"`
+ Color string `json:"color,omitempty"`
+}
diff --git a/samples/client/petstore/go-experimental/go-petstore/model_api_response.go b/samples/client/petstore/go-experimental/go-petstore/model_api_response.go
new file mode 100644
index 000000000000..12732fa32c6b
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/model_api_response.go
@@ -0,0 +1,16 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * API version: 1.0.0
+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)
+ */
+
+package petstore
+
+type ApiResponse struct {
+ Code int32 `json:"code,omitempty"`
+ Type string `json:"type,omitempty"`
+ Message string `json:"message,omitempty"`
+}
diff --git a/samples/client/petstore/go-experimental/go-petstore/model_array_of_array_of_number_only.go b/samples/client/petstore/go-experimental/go-petstore/model_array_of_array_of_number_only.go
new file mode 100644
index 000000000000..8bf700c7eb30
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/model_array_of_array_of_number_only.go
@@ -0,0 +1,14 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * API version: 1.0.0
+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)
+ */
+
+package petstore
+
+type ArrayOfArrayOfNumberOnly struct {
+ ArrayArrayNumber [][]float32 `json:"ArrayArrayNumber,omitempty"`
+}
diff --git a/samples/client/petstore/go-experimental/go-petstore/model_array_of_number_only.go b/samples/client/petstore/go-experimental/go-petstore/model_array_of_number_only.go
new file mode 100644
index 000000000000..ccb473355caa
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/model_array_of_number_only.go
@@ -0,0 +1,14 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * API version: 1.0.0
+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)
+ */
+
+package petstore
+
+type ArrayOfNumberOnly struct {
+ ArrayNumber []float32 `json:"ArrayNumber,omitempty"`
+}
diff --git a/samples/client/petstore/go-experimental/go-petstore/model_array_test_.go b/samples/client/petstore/go-experimental/go-petstore/model_array_test_.go
new file mode 100644
index 000000000000..f8819800934b
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/model_array_test_.go
@@ -0,0 +1,16 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * API version: 1.0.0
+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)
+ */
+
+package petstore
+
+type ArrayTest struct {
+ ArrayOfString []string `json:"array_of_string,omitempty"`
+ ArrayArrayOfInteger [][]int64 `json:"array_array_of_integer,omitempty"`
+ ArrayArrayOfModel [][]ReadOnlyFirst `json:"array_array_of_model,omitempty"`
+}
diff --git a/samples/client/petstore/go-experimental/go-petstore/model_capitalization.go b/samples/client/petstore/go-experimental/go-petstore/model_capitalization.go
new file mode 100644
index 000000000000..8284ba9c7658
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/model_capitalization.go
@@ -0,0 +1,20 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * API version: 1.0.0
+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)
+ */
+
+package petstore
+
+type Capitalization struct {
+ SmallCamel string `json:"smallCamel,omitempty"`
+ CapitalCamel string `json:"CapitalCamel,omitempty"`
+ SmallSnake string `json:"small_Snake,omitempty"`
+ CapitalSnake string `json:"Capital_Snake,omitempty"`
+ SCAETHFlowPoints string `json:"SCA_ETH_Flow_Points,omitempty"`
+ // Name of the pet
+ ATT_NAME string `json:"ATT_NAME,omitempty"`
+}
diff --git a/samples/client/petstore/go-experimental/go-petstore/model_cat.go b/samples/client/petstore/go-experimental/go-petstore/model_cat.go
new file mode 100644
index 000000000000..58b3deeb938d
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/model_cat.go
@@ -0,0 +1,16 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * API version: 1.0.0
+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)
+ */
+
+package petstore
+
+type Cat struct {
+ ClassName string `json:"className"`
+ Color string `json:"color,omitempty"`
+ Declawed bool `json:"declawed,omitempty"`
+}
diff --git a/samples/client/petstore/go-experimental/go-petstore/model_cat_all_of.go b/samples/client/petstore/go-experimental/go-petstore/model_cat_all_of.go
new file mode 100644
index 000000000000..3c1d802bd411
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/model_cat_all_of.go
@@ -0,0 +1,14 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * API version: 1.0.0
+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)
+ */
+
+package petstore
+
+type CatAllOf struct {
+ Declawed bool `json:"declawed,omitempty"`
+}
diff --git a/samples/client/petstore/go-experimental/go-petstore/model_category.go b/samples/client/petstore/go-experimental/go-petstore/model_category.go
new file mode 100644
index 000000000000..2f971417ac10
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/model_category.go
@@ -0,0 +1,15 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * API version: 1.0.0
+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)
+ */
+
+package petstore
+
+type Category struct {
+ Id int64 `json:"id,omitempty"`
+ Name string `json:"name"`
+}
diff --git a/samples/client/petstore/go-experimental/go-petstore/model_class_model.go b/samples/client/petstore/go-experimental/go-petstore/model_class_model.go
new file mode 100644
index 000000000000..09c7e891968a
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/model_class_model.go
@@ -0,0 +1,15 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * API version: 1.0.0
+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)
+ */
+
+package petstore
+
+// Model for testing model with \"_class\" property
+type ClassModel struct {
+ Class string `json:"_class,omitempty"`
+}
diff --git a/samples/client/petstore/go-experimental/go-petstore/model_client.go b/samples/client/petstore/go-experimental/go-petstore/model_client.go
new file mode 100644
index 000000000000..3aa61112c4da
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/model_client.go
@@ -0,0 +1,14 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * API version: 1.0.0
+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)
+ */
+
+package petstore
+
+type Client struct {
+ Client string `json:"client,omitempty"`
+}
diff --git a/samples/client/petstore/go-experimental/go-petstore/model_dog.go b/samples/client/petstore/go-experimental/go-petstore/model_dog.go
new file mode 100644
index 000000000000..3f791ca1947d
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/model_dog.go
@@ -0,0 +1,16 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * API version: 1.0.0
+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)
+ */
+
+package petstore
+
+type Dog struct {
+ ClassName string `json:"className"`
+ Color string `json:"color,omitempty"`
+ Breed string `json:"breed,omitempty"`
+}
diff --git a/samples/client/petstore/go-experimental/go-petstore/model_dog_all_of.go b/samples/client/petstore/go-experimental/go-petstore/model_dog_all_of.go
new file mode 100644
index 000000000000..a0db0aba4b53
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/model_dog_all_of.go
@@ -0,0 +1,14 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * API version: 1.0.0
+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)
+ */
+
+package petstore
+
+type DogAllOf struct {
+ Breed string `json:"breed,omitempty"`
+}
diff --git a/samples/client/petstore/go-experimental/go-petstore/model_enum_arrays.go b/samples/client/petstore/go-experimental/go-petstore/model_enum_arrays.go
new file mode 100644
index 000000000000..ab4dce92ebbc
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/model_enum_arrays.go
@@ -0,0 +1,15 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * API version: 1.0.0
+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)
+ */
+
+package petstore
+
+type EnumArrays struct {
+ JustSymbol string `json:"just_symbol,omitempty"`
+ ArrayEnum []string `json:"array_enum,omitempty"`
+}
diff --git a/samples/client/petstore/go-experimental/go-petstore/model_enum_class.go b/samples/client/petstore/go-experimental/go-petstore/model_enum_class.go
new file mode 100644
index 000000000000..534ce4328817
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/model_enum_class.go
@@ -0,0 +1,18 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * API version: 1.0.0
+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)
+ */
+
+package petstore
+type EnumClass string
+
+// List of EnumClass
+const (
+ ABC EnumClass = "_abc"
+ EFG EnumClass = "-efg"
+ XYZ EnumClass = "(xyz)"
+)
\ No newline at end of file
diff --git a/samples/client/petstore/go-experimental/go-petstore/model_enum_test_.go b/samples/client/petstore/go-experimental/go-petstore/model_enum_test_.go
new file mode 100644
index 000000000000..f85f31501a01
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/model_enum_test_.go
@@ -0,0 +1,18 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * API version: 1.0.0
+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)
+ */
+
+package petstore
+
+type EnumTest struct {
+ EnumString string `json:"enum_string,omitempty"`
+ EnumStringRequired string `json:"enum_string_required"`
+ EnumInteger int32 `json:"enum_integer,omitempty"`
+ EnumNumber float64 `json:"enum_number,omitempty"`
+ OuterEnum OuterEnum `json:"outerEnum,omitempty"`
+}
diff --git a/samples/client/petstore/go-experimental/go-petstore/model_file.go b/samples/client/petstore/go-experimental/go-petstore/model_file.go
new file mode 100644
index 000000000000..2782ccc9a2aa
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/model_file.go
@@ -0,0 +1,16 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * API version: 1.0.0
+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)
+ */
+
+package petstore
+
+// Must be named `File` for test.
+type File struct {
+ // Test capitalization
+ SourceURI string `json:"sourceURI,omitempty"`
+}
diff --git a/samples/client/petstore/go-experimental/go-petstore/model_file_schema_test_class.go b/samples/client/petstore/go-experimental/go-petstore/model_file_schema_test_class.go
new file mode 100644
index 000000000000..487f766c6492
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/model_file_schema_test_class.go
@@ -0,0 +1,15 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * API version: 1.0.0
+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)
+ */
+
+package petstore
+
+type FileSchemaTestClass struct {
+ File File `json:"file,omitempty"`
+ Files []File `json:"files,omitempty"`
+}
diff --git a/samples/client/petstore/go-experimental/go-petstore/model_format_test_.go b/samples/client/petstore/go-experimental/go-petstore/model_format_test_.go
new file mode 100644
index 000000000000..d723bdfee39e
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/model_format_test_.go
@@ -0,0 +1,30 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * API version: 1.0.0
+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)
+ */
+
+package petstore
+import (
+ "os"
+ "time"
+)
+
+type FormatTest struct {
+ Integer int32 `json:"integer,omitempty"`
+ Int32 int32 `json:"int32,omitempty"`
+ Int64 int64 `json:"int64,omitempty"`
+ Number float32 `json:"number"`
+ Float float32 `json:"float,omitempty"`
+ Double float64 `json:"double,omitempty"`
+ String string `json:"string,omitempty"`
+ Byte string `json:"byte"`
+ Binary *os.File `json:"binary,omitempty"`
+ Date string `json:"date"`
+ DateTime time.Time `json:"dateTime,omitempty"`
+ Uuid string `json:"uuid,omitempty"`
+ Password string `json:"password"`
+}
diff --git a/samples/client/petstore/go-experimental/go-petstore/model_has_only_read_only.go b/samples/client/petstore/go-experimental/go-petstore/model_has_only_read_only.go
new file mode 100644
index 000000000000..1cf0e4f530d4
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/model_has_only_read_only.go
@@ -0,0 +1,15 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * API version: 1.0.0
+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)
+ */
+
+package petstore
+
+type HasOnlyReadOnly struct {
+ Bar string `json:"bar,omitempty"`
+ Foo string `json:"foo,omitempty"`
+}
diff --git a/samples/client/petstore/go-experimental/go-petstore/model_list.go b/samples/client/petstore/go-experimental/go-petstore/model_list.go
new file mode 100644
index 000000000000..12f3bd3f6600
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/model_list.go
@@ -0,0 +1,14 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * API version: 1.0.0
+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)
+ */
+
+package petstore
+
+type List struct {
+ Var123List string `json:"123-list,omitempty"`
+}
diff --git a/samples/client/petstore/go-experimental/go-petstore/model_map_test_.go b/samples/client/petstore/go-experimental/go-petstore/model_map_test_.go
new file mode 100644
index 000000000000..830e760fe314
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/model_map_test_.go
@@ -0,0 +1,17 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * API version: 1.0.0
+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)
+ */
+
+package petstore
+
+type MapTest struct {
+ MapMapOfString map[string]map[string]string `json:"map_map_of_string,omitempty"`
+ MapOfEnumString map[string]string `json:"map_of_enum_string,omitempty"`
+ DirectMap map[string]bool `json:"direct_map,omitempty"`
+ IndirectMap map[string]bool `json:"indirect_map,omitempty"`
+}
diff --git a/samples/client/petstore/go-experimental/go-petstore/model_mixed_properties_and_additional_properties_class.go b/samples/client/petstore/go-experimental/go-petstore/model_mixed_properties_and_additional_properties_class.go
new file mode 100644
index 000000000000..0ad92e96f8ec
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/model_mixed_properties_and_additional_properties_class.go
@@ -0,0 +1,19 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * API version: 1.0.0
+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)
+ */
+
+package petstore
+import (
+ "time"
+)
+
+type MixedPropertiesAndAdditionalPropertiesClass struct {
+ Uuid string `json:"uuid,omitempty"`
+ DateTime time.Time `json:"dateTime,omitempty"`
+ Map map[string]Animal `json:"map,omitempty"`
+}
diff --git a/samples/client/petstore/go-experimental/go-petstore/model_name.go b/samples/client/petstore/go-experimental/go-petstore/model_name.go
new file mode 100644
index 000000000000..dde1b92eb6ab
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/model_name.go
@@ -0,0 +1,18 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * API version: 1.0.0
+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)
+ */
+
+package petstore
+
+// Model for testing model name same as property name
+type Name struct {
+ Name int32 `json:"name"`
+ SnakeCase int32 `json:"snake_case,omitempty"`
+ Property string `json:"property,omitempty"`
+ Var123Number int32 `json:"123Number,omitempty"`
+}
diff --git a/samples/client/petstore/go-experimental/go-petstore/model_number_only.go b/samples/client/petstore/go-experimental/go-petstore/model_number_only.go
new file mode 100644
index 000000000000..7a2fd5fd8f6d
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/model_number_only.go
@@ -0,0 +1,14 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * API version: 1.0.0
+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)
+ */
+
+package petstore
+
+type NumberOnly struct {
+ JustNumber float32 `json:"JustNumber,omitempty"`
+}
diff --git a/samples/client/petstore/go-experimental/go-petstore/model_order.go b/samples/client/petstore/go-experimental/go-petstore/model_order.go
new file mode 100644
index 000000000000..c81d67ae0fa4
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/model_order.go
@@ -0,0 +1,23 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * API version: 1.0.0
+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)
+ */
+
+package petstore
+import (
+ "time"
+)
+
+type Order struct {
+ Id int64 `json:"id,omitempty"`
+ PetId int64 `json:"petId,omitempty"`
+ Quantity int32 `json:"quantity,omitempty"`
+ ShipDate time.Time `json:"shipDate,omitempty"`
+ // Order Status
+ Status string `json:"status,omitempty"`
+ Complete bool `json:"complete,omitempty"`
+}
diff --git a/samples/client/petstore/go-experimental/go-petstore/model_outer_composite.go b/samples/client/petstore/go-experimental/go-petstore/model_outer_composite.go
new file mode 100644
index 000000000000..0ebb526267e8
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/model_outer_composite.go
@@ -0,0 +1,16 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * API version: 1.0.0
+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)
+ */
+
+package petstore
+
+type OuterComposite struct {
+ MyNumber float32 `json:"my_number,omitempty"`
+ MyString string `json:"my_string,omitempty"`
+ MyBoolean bool `json:"my_boolean,omitempty"`
+}
diff --git a/samples/client/petstore/go-experimental/go-petstore/model_outer_enum.go b/samples/client/petstore/go-experimental/go-petstore/model_outer_enum.go
new file mode 100644
index 000000000000..903d31e82690
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/model_outer_enum.go
@@ -0,0 +1,18 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * API version: 1.0.0
+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)
+ */
+
+package petstore
+type OuterEnum string
+
+// List of OuterEnum
+const (
+ PLACED OuterEnum = "placed"
+ APPROVED OuterEnum = "approved"
+ DELIVERED OuterEnum = "delivered"
+)
\ No newline at end of file
diff --git a/samples/client/petstore/go-experimental/go-petstore/model_pet.go b/samples/client/petstore/go-experimental/go-petstore/model_pet.go
new file mode 100644
index 000000000000..4930dbb92e8e
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/model_pet.go
@@ -0,0 +1,20 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * API version: 1.0.0
+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)
+ */
+
+package petstore
+
+type Pet struct {
+ Id int64 `json:"id,omitempty"`
+ Category Category `json:"category,omitempty"`
+ Name string `json:"name"`
+ PhotoUrls []string `json:"photoUrls"`
+ Tags []Tag `json:"tags,omitempty"`
+ // pet status in the store
+ Status string `json:"status,omitempty"`
+}
diff --git a/samples/client/petstore/go-experimental/go-petstore/model_read_only_first.go b/samples/client/petstore/go-experimental/go-petstore/model_read_only_first.go
new file mode 100644
index 000000000000..6b22163900b0
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/model_read_only_first.go
@@ -0,0 +1,15 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * API version: 1.0.0
+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)
+ */
+
+package petstore
+
+type ReadOnlyFirst struct {
+ Bar string `json:"bar,omitempty"`
+ Baz string `json:"baz,omitempty"`
+}
diff --git a/samples/client/petstore/go-experimental/go-petstore/model_return.go b/samples/client/petstore/go-experimental/go-petstore/model_return.go
new file mode 100644
index 000000000000..7851dd851d31
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/model_return.go
@@ -0,0 +1,15 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * API version: 1.0.0
+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)
+ */
+
+package petstore
+
+// Model for testing reserved words
+type Return struct {
+ Return int32 `json:"return,omitempty"`
+}
diff --git a/samples/client/petstore/go-experimental/go-petstore/model_special_model_name.go b/samples/client/petstore/go-experimental/go-petstore/model_special_model_name.go
new file mode 100644
index 000000000000..f906e91987dc
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/model_special_model_name.go
@@ -0,0 +1,14 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * API version: 1.0.0
+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)
+ */
+
+package petstore
+
+type SpecialModelName struct {
+ SpecialPropertyName int64 `json:"$special[property.name],omitempty"`
+}
diff --git a/samples/client/petstore/go-experimental/go-petstore/model_tag.go b/samples/client/petstore/go-experimental/go-petstore/model_tag.go
new file mode 100644
index 000000000000..37a2b63d4451
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/model_tag.go
@@ -0,0 +1,15 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * API version: 1.0.0
+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)
+ */
+
+package petstore
+
+type Tag struct {
+ Id int64 `json:"id,omitempty"`
+ Name string `json:"name,omitempty"`
+}
diff --git a/samples/client/petstore/go-experimental/go-petstore/model_type_holder_default.go b/samples/client/petstore/go-experimental/go-petstore/model_type_holder_default.go
new file mode 100644
index 000000000000..68e1218ec951
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/model_type_holder_default.go
@@ -0,0 +1,18 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * API version: 1.0.0
+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)
+ */
+
+package petstore
+
+type TypeHolderDefault struct {
+ StringItem string `json:"string_item"`
+ NumberItem float32 `json:"number_item"`
+ IntegerItem int32 `json:"integer_item"`
+ BoolItem bool `json:"bool_item"`
+ ArrayItem []int32 `json:"array_item"`
+}
diff --git a/samples/client/petstore/go-experimental/go-petstore/model_type_holder_example.go b/samples/client/petstore/go-experimental/go-petstore/model_type_holder_example.go
new file mode 100644
index 000000000000..e129bb6a765f
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/model_type_holder_example.go
@@ -0,0 +1,18 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * API version: 1.0.0
+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)
+ */
+
+package petstore
+
+type TypeHolderExample struct {
+ StringItem string `json:"string_item"`
+ NumberItem float32 `json:"number_item"`
+ IntegerItem int32 `json:"integer_item"`
+ BoolItem bool `json:"bool_item"`
+ ArrayItem []int32 `json:"array_item"`
+}
diff --git a/samples/client/petstore/go-experimental/go-petstore/model_user.go b/samples/client/petstore/go-experimental/go-petstore/model_user.go
new file mode 100644
index 000000000000..caff75ebc2c5
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/model_user.go
@@ -0,0 +1,22 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * API version: 1.0.0
+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)
+ */
+
+package petstore
+
+type User struct {
+ Id int64 `json:"id,omitempty"`
+ Username string `json:"username,omitempty"`
+ FirstName string `json:"firstName,omitempty"`
+ LastName string `json:"lastName,omitempty"`
+ Email string `json:"email,omitempty"`
+ Password string `json:"password,omitempty"`
+ Phone string `json:"phone,omitempty"`
+ // User Status
+ UserStatus int32 `json:"userStatus,omitempty"`
+}
diff --git a/samples/client/petstore/go-experimental/go-petstore/model_xml_item.go b/samples/client/petstore/go-experimental/go-petstore/model_xml_item.go
new file mode 100644
index 000000000000..a623bda5c742
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/model_xml_item.go
@@ -0,0 +1,42 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * API version: 1.0.0
+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)
+ */
+
+package petstore
+
+type XmlItem struct {
+ AttributeString string `json:"attribute_string,omitempty"`
+ AttributeNumber float32 `json:"attribute_number,omitempty"`
+ AttributeInteger int32 `json:"attribute_integer,omitempty"`
+ AttributeBoolean bool `json:"attribute_boolean,omitempty"`
+ WrappedArray []int32 `json:"wrapped_array,omitempty"`
+ NameString string `json:"name_string,omitempty"`
+ NameNumber float32 `json:"name_number,omitempty"`
+ NameInteger int32 `json:"name_integer,omitempty"`
+ NameBoolean bool `json:"name_boolean,omitempty"`
+ NameArray []int32 `json:"name_array,omitempty"`
+ NameWrappedArray []int32 `json:"name_wrapped_array,omitempty"`
+ PrefixString string `json:"prefix_string,omitempty"`
+ PrefixNumber float32 `json:"prefix_number,omitempty"`
+ PrefixInteger int32 `json:"prefix_integer,omitempty"`
+ PrefixBoolean bool `json:"prefix_boolean,omitempty"`
+ PrefixArray []int32 `json:"prefix_array,omitempty"`
+ PrefixWrappedArray []int32 `json:"prefix_wrapped_array,omitempty"`
+ NamespaceString string `json:"namespace_string,omitempty"`
+ NamespaceNumber float32 `json:"namespace_number,omitempty"`
+ NamespaceInteger int32 `json:"namespace_integer,omitempty"`
+ NamespaceBoolean bool `json:"namespace_boolean,omitempty"`
+ NamespaceArray []int32 `json:"namespace_array,omitempty"`
+ NamespaceWrappedArray []int32 `json:"namespace_wrapped_array,omitempty"`
+ PrefixNsString string `json:"prefix_ns_string,omitempty"`
+ PrefixNsNumber float32 `json:"prefix_ns_number,omitempty"`
+ PrefixNsInteger int32 `json:"prefix_ns_integer,omitempty"`
+ PrefixNsBoolean bool `json:"prefix_ns_boolean,omitempty"`
+ PrefixNsArray []int32 `json:"prefix_ns_array,omitempty"`
+ PrefixNsWrappedArray []int32 `json:"prefix_ns_wrapped_array,omitempty"`
+}
diff --git a/samples/client/petstore/go-experimental/go-petstore/response.go b/samples/client/petstore/go-experimental/go-petstore/response.go
new file mode 100644
index 000000000000..38f373df75ee
--- /dev/null
+++ b/samples/client/petstore/go-experimental/go-petstore/response.go
@@ -0,0 +1,43 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * API version: 1.0.0
+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)
+ */
+
+package petstore
+
+import (
+ "net/http"
+)
+
+type APIResponse struct {
+ *http.Response `json:"-"`
+ Message string `json:"message,omitempty"`
+ // Operation is the name of the OpenAPI operation.
+ Operation string `json:"operation,omitempty"`
+ // RequestURL is the request URL. This value is always available, even if the
+ // embedded *http.Response is nil.
+ RequestURL string `json:"url,omitempty"`
+ // Method is the HTTP method used for the request. This value is always
+ // available, even if the embedded *http.Response is nil.
+ Method string `json:"method,omitempty"`
+ // Payload holds the contents of the response body (which may be nil or empty).
+ // This is provided here as the raw response.Body() reader will have already
+ // been drained.
+ Payload []byte `json:"-"`
+}
+
+func NewAPIResponse(r *http.Response) *APIResponse {
+
+ response := &APIResponse{Response: r}
+ return response
+}
+
+func NewAPIResponseWithError(errorMessage string) *APIResponse {
+
+ response := &APIResponse{Message: errorMessage}
+ return response
+}
diff --git a/samples/client/petstore/go-experimental/pet_api_test.go b/samples/client/petstore/go-experimental/pet_api_test.go
new file mode 100644
index 000000000000..969fab1f667a
--- /dev/null
+++ b/samples/client/petstore/go-experimental/pet_api_test.go
@@ -0,0 +1,297 @@
+package main
+
+import (
+ "context"
+ "fmt"
+ "os"
+ "testing"
+
+ "github.com/antihax/optional"
+ "github.com/stretchr/testify/assert"
+
+ sw "./go-petstore"
+)
+
+var client *sw.APIClient
+
+const testHost = "petstore.swagger.io:80"
+const testScheme = "http"
+
+func TestMain(m *testing.M) {
+ cfg := sw.NewConfiguration()
+ cfg.AddDefaultHeader("testheader", "testvalue")
+ cfg.Host = testHost
+ cfg.Scheme = testScheme
+ client = sw.NewAPIClient(cfg)
+ retCode := m.Run()
+ os.Exit(retCode)
+}
+
+func TestAddPet(t *testing.T) {
+ newPet := (sw.Pet{Id: 12830, Name: "gopher",
+ PhotoUrls: []string{"http://1.com", "http://2.com"}, Status: "pending", Tags: []sw.Tag{sw.Tag{Id: 1, Name: "tag2"}}})
+
+ r, err := client.PetApi.AddPet(context.Background(), newPet)
+
+ if err != nil {
+ t.Fatalf("Error while adding pet: %v", err)
+ }
+ if r.StatusCode != 200 {
+ t.Log(r)
+ }
+}
+
+func TestFindPetsByStatusWithMissingParam(t *testing.T) {
+ _, r, err := client.PetApi.FindPetsByStatus(context.Background(), nil)
+
+ if err != nil {
+ t.Fatalf("Error while testing TestFindPetsByStatusWithMissingParam: %v", err)
+ }
+ if r.StatusCode != 200 {
+ t.Log(r)
+ }
+}
+
+func TestGetPetById(t *testing.T) {
+ isPetCorrect(t, 12830, "gopher", "pending")
+}
+
+func TestGetPetByIdWithInvalidID(t *testing.T) {
+ resp, r, err := client.PetApi.GetPetById(context.Background(), 999999999)
+ if r != nil && r.StatusCode == 404 {
+ assertedError, ok := err.(sw.GenericOpenAPIError)
+ a := assert.New(t)
+ a.True(ok)
+ a.Contains(string(assertedError.Body()), "type")
+
+ a.Contains(assertedError.Error(), "Not Found")
+ } else if err != nil {
+ t.Fatalf("Error while getting pet by invalid id: %v", err)
+ t.Log(r)
+ } else {
+ t.Log(resp)
+ }
+}
+
+func TestUpdatePetWithForm(t *testing.T) {
+ r, err := client.PetApi.UpdatePetWithForm(context.Background(), 12830, &sw.UpdatePetWithFormOpts{
+ Name: optional.NewString("golang"),
+ Status: optional.NewString("available"),
+ })
+ if err != nil {
+ t.Fatalf("Error while updating pet by id: %v", err)
+ t.Log(r)
+ }
+ if r.StatusCode != 200 {
+ t.Log(r)
+ }
+
+ // get the pet with id 12830 from server to verify the update
+ isPetCorrect(t, 12830, "golang", "available")
+}
+
+func TestFindPetsByTag(t *testing.T) {
+ var found = false
+ resp, r, err := client.PetApi.FindPetsByTags(context.Background(), []string{"tag2"})
+ if err != nil {
+ t.Fatalf("Error while getting pet by tag: %v", err)
+ t.Log(r)
+ } else {
+ if len(resp) == 0 {
+ t.Errorf("Error no pets returned")
+ } else {
+
+ assert := assert.New(t)
+ for i := 0; i < len(resp); i++ {
+ if resp[i].Id == 12830 {
+ assert.Equal(resp[i].Status, "available", "Pet status should be `pending`")
+ found = true
+ }
+ }
+ }
+
+ if found == false {
+ t.Errorf("Error while getting pet by tag could not find 12830")
+ }
+
+ if r.StatusCode != 200 {
+ t.Log(r)
+ }
+ }
+}
+
+func TestFindPetsByStatus(t *testing.T) {
+ resp, r, err := client.PetApi.FindPetsByStatus(context.Background(), []string{"available"})
+ if err != nil {
+ t.Fatalf("Error while getting pet by id: %v", err)
+ t.Log(r)
+ } else {
+ if len(resp) == 0 {
+ t.Errorf("Error no pets returned")
+ } else {
+ assert := assert.New(t)
+ for i := 0; i < len(resp); i++ {
+ assert.Equal(resp[i].Status, "available", "Pet status should be `available`")
+ }
+ }
+
+ if r.StatusCode != 200 {
+ t.Log(r)
+ }
+ }
+}
+
+func TestUploadFile(t *testing.T) {
+ file, _ := os.Open("../python/testfiles/foo.png")
+
+ _, r, err := client.PetApi.UploadFile(context.Background(), 12830, &sw.UploadFileOpts{
+ AdditionalMetadata: optional.NewString("golang"),
+ File: optional.NewInterface(file),
+ })
+
+ if err != nil {
+ t.Fatalf("Error while uploading file: %v", err)
+ }
+
+ if r.StatusCode != 200 {
+ t.Log(r)
+ }
+}
+
+func TestUploadFileRequired(t *testing.T) {
+ return // remove when server supports this endpoint
+ file, _ := os.Open("../python/testfiles/foo.png")
+
+ _, r, err := client.PetApi.UploadFileWithRequiredFile(context.Background(), 12830,
+ file,
+ &sw.UploadFileWithRequiredFileOpts{
+ AdditionalMetadata: optional.NewString("golang"),
+ })
+
+ if err != nil {
+ t.Fatalf("Error while uploading file: %v", err)
+ }
+
+ if r.StatusCode != 200 {
+ t.Log(r)
+ }
+}
+
+func TestDeletePet(t *testing.T) {
+ r, err := client.PetApi.DeletePet(context.Background(), 12830, nil)
+
+ if err != nil {
+ t.Fatalf("Error while deleting pet by id: %v", err)
+ }
+ if r.StatusCode != 200 {
+ t.Log(r)
+ }
+}
+
+/*
+// Test we can concurrently create, retrieve, update, and delete.
+func TestConcurrency(t *testing.T) {
+ errc := make(chan error)
+
+ newPets := []sw.Pet{
+ sw.Pet{Id: 912345, Name: "gopherFred", PhotoUrls: []string{"http://1.com", "http://2.com"}, Status: "pending"},
+ sw.Pet{Id: 912346, Name: "gopherDan", PhotoUrls: []string{"http://1.com", "http://2.com"}, Status: "active"},
+ sw.Pet{Id: 912347, Name: "gopherRick", PhotoUrls: []string{"http://1.com", "http://2.com"}, Status: "mia"},
+ sw.Pet{Id: 912348, Name: "gopherJohn", PhotoUrls: []string{"http://1.com", "http://2.com"}, Status: "active"},
+ sw.Pet{Id: 912349, Name: "gopherAlf", PhotoUrls: []string{"http://1.com", "http://2.com"}, Status: "pending"},
+ sw.Pet{Id: 912350, Name: "gopherRob", PhotoUrls: []string{"http://1.com", "http://2.com"}, Status: "pending"},
+ sw.Pet{Id: 912351, Name: "gopherIan", PhotoUrls: []string{"http://1.com", "http://2.com"}, Status: "active"},
+ }
+
+ // Add the pets.
+ for _, pet := range newPets {
+ go func(newPet sw.Pet) {
+ r, err := client.PetApi.AddPet(nil, newPet)
+ if r.StatusCode != 200 {
+ t.Log(r)
+ }
+ errc <- err
+ }(pet)
+ }
+ waitOnFunctions(t, errc, len(newPets))
+
+ // Verify they are correct.
+ for _, pet := range newPets {
+ go func(pet sw.Pet) {
+ isPetCorrect(t, pet.Id, pet.Name, pet.Status)
+ errc <- nil
+ }(pet)
+ }
+
+ waitOnFunctions(t, errc, len(newPets))
+
+ // Update all to active with the name gopherDan
+ for _, pet := range newPets {
+ go func(id int64) {
+ r, err := client.PetApi.UpdatePet(nil, sw.Pet{Id: (int64)(id), Name: "gopherDan", PhotoUrls: []string{"http://1.com", "http://2.com"}, Status: "active"})
+ if r.StatusCode != 200 {
+ t.Log(r)
+ }
+ errc <- err
+ }(pet.Id)
+ }
+ waitOnFunctions(t, errc, len(newPets))
+
+ // Verify they are correct.
+ for _, pet := range newPets {
+ go func(pet sw.Pet) {
+ isPetCorrect(t, pet.Id, "gopherDan", "active")
+ errc <- nil
+ }(pet)
+ }
+
+ waitOnFunctions(t, errc, len(newPets))
+
+ // Delete them all.
+ for _, pet := range newPets {
+ go func(id int64) {
+ deletePet(t, (int64)(id))
+ errc <- nil
+ }(pet.Id)
+ }
+ waitOnFunctions(t, errc, len(newPets))
+}
+*/
+
+func waitOnFunctions(t *testing.T, errc chan error, n int) {
+ for i := 0; i < n; i++ {
+ err := <-errc
+ if err != nil {
+ t.Fatalf("Error performing concurrent test: %v", err)
+ }
+ }
+}
+
+func deletePet(t *testing.T, id int64) {
+ r, err := client.PetApi.DeletePet(context.Background(), id, nil)
+
+ if err != nil {
+ t.Fatalf("Error while deleting pet by id: %v", err)
+ }
+ if r.StatusCode != 200 {
+ t.Log(r)
+ }
+}
+
+func isPetCorrect(t *testing.T, id int64, name string, status string) {
+ assert := assert.New(t)
+ resp, r, err := client.PetApi.GetPetById(context.Background(), id)
+ if err != nil {
+ t.Fatalf("Error while getting pet by id: %v", err)
+ } else {
+ assert.Equal(resp.Id, int64(id), "Pet id should be equal")
+ assert.Equal(resp.Name, name, fmt.Sprintf("Pet name should be %s", name))
+ assert.Equal(resp.Status, status, fmt.Sprintf("Pet status should be %s", status))
+
+ //t.Log(resp)
+ }
+ if r.StatusCode != 200 {
+ t.Log(r)
+ }
+}
+
diff --git a/samples/client/petstore/go-experimental/pom.xml b/samples/client/petstore/go-experimental/pom.xml
new file mode 100644
index 000000000000..91e3da8c34b4
--- /dev/null
+++ b/samples/client/petstore/go-experimental/pom.xml
@@ -0,0 +1,103 @@
+
+ 4.0.0
+ org.openapitools
+ GoExperimentalPetstore
+ pom
+ 1.0.0
+ Go Experimental Petstore Client
+
+
+
+ maven-dependency-plugin
+
+
+ package
+
+ copy-dependencies
+
+
+ ${project.build.directory}
+
+
+
+
+
+ org.codehaus.mojo
+ exec-maven-plugin
+ 1.2.1
+
+
+ go-get-testify
+ pre-integration-test
+
+ exec
+
+
+ go
+
+ get
+ github.com/stretchr/testify/assert
+
+
+
+
+ go-get-oauth2
+ pre-integration-test
+
+ exec
+
+
+ go
+
+ get
+ golang.org/x/oauth2
+
+
+
+
+ go-get-context
+ pre-integration-test
+
+ exec
+
+
+ go
+
+ get
+ golang.org/x/net/context
+
+
+
+
+ go-get-optional
+ pre-integration-test
+
+ exec
+
+
+ go
+
+ get
+ github.com/antihax/optional
+
+
+
+
+ go-test
+ integration-test
+
+ exec
+
+
+ go
+
+ test
+ -v
+
+
+
+
+
+
+
+
diff --git a/samples/client/petstore/go-experimental/store_api_test.go b/samples/client/petstore/go-experimental/store_api_test.go
new file mode 100644
index 000000000000..3088adf7b40d
--- /dev/null
+++ b/samples/client/petstore/go-experimental/store_api_test.go
@@ -0,0 +1,37 @@
+package main
+
+import (
+ "context"
+ "regexp"
+ "testing"
+ "time"
+
+ sw "./go-petstore"
+)
+
+func TestPlaceOrder(t *testing.T) {
+ newOrder := sw.Order{
+ Id: 0,
+ PetId: 0,
+ Quantity: 0,
+ ShipDate: time.Now().UTC(),
+ Status: "placed",
+ Complete: false}
+
+ _, r, err := client.StoreApi.PlaceOrder(context.Background(), newOrder)
+
+ if err != nil {
+ // Skip parsing time error due to error in Petstore Test Server
+ // https://github.com/OpenAPITools/openapi-generator/issues/1292
+ if regexp.
+ MustCompile(`^parsing time.+cannot parse "\+0000"" as "Z07:00"$`).
+ MatchString(err.Error()) {
+ t.Log("Skipping error for parsing time with `+0000` UTC offset as Petstore Test Server does not return valid RFC 3339 datetime")
+ } else {
+ t.Fatalf("Error while placing order: %v", err)
+ }
+ }
+ if r.StatusCode != 200 {
+ t.Log(r)
+ }
+}
diff --git a/samples/client/petstore/go-experimental/test.go.bak b/samples/client/petstore/go-experimental/test.go.bak
new file mode 100644
index 000000000000..54e14b9c7a04
--- /dev/null
+++ b/samples/client/petstore/go-experimental/test.go.bak
@@ -0,0 +1,30 @@
+package main
+
+import (
+ sw "./go-petstore"
+ "encoding/json"
+ "fmt"
+)
+
+func main() {
+
+ s := sw.NewPetApi()
+
+ // test POST(body)
+ newPet := (sw.Pet{Id: 12830, Name: "gopher",
+ PhotoUrls: []string{"http://1.com", "http://2.com"}, Status: "pending"})
+
+ jsonNewPet, _ := json.Marshal(newPet)
+ fmt.Println("newPet:", string(jsonNewPet))
+ s.AddPet(newPet)
+
+ // test POST(form)
+ s.UpdatePetWithForm(12830, "golang", "available")
+
+ // test GET
+ resp, apiResponse, err := s.GetPetById(12830)
+ fmt.Println("GetPetById: ", resp, err, apiResponse)
+
+ err2, apiResponse2 := s.DeletePet(12830, "")
+ fmt.Println("DeletePet: ", err2, apiResponse2)
+}
diff --git a/samples/client/petstore/go-experimental/user_api_test.go b/samples/client/petstore/go-experimental/user_api_test.go
new file mode 100644
index 000000000000..012c608fab6b
--- /dev/null
+++ b/samples/client/petstore/go-experimental/user_api_test.go
@@ -0,0 +1,153 @@
+package main
+
+import (
+ "context"
+ "testing"
+
+ "github.com/stretchr/testify/assert"
+
+ sw "./go-petstore"
+)
+
+func TestCreateUser(t *testing.T) {
+ newUser := sw.User{
+ Id: 1000,
+ FirstName: "gopher",
+ LastName: "lang",
+ Username: "gopher",
+ Password: "lang",
+ Email: "lang@test.com",
+ Phone: "5101112222",
+ UserStatus: 1}
+
+ apiResponse, err := client.UserApi.CreateUser(context.Background(), newUser)
+
+ if err != nil {
+ t.Fatalf("Error while adding user: %v", err)
+ }
+ if apiResponse.StatusCode != 200 {
+ t.Log(apiResponse)
+ }
+}
+
+//adding x to skip the test, currently it is failing
+func TestCreateUsersWithArrayInput(t *testing.T) {
+ newUsers := []sw.User{
+ sw.User{
+ Id: int64(1001),
+ FirstName: "gopher1",
+ LastName: "lang1",
+ Username: "gopher1",
+ Password: "lang1",
+ Email: "lang1@test.com",
+ Phone: "5101112222",
+ UserStatus: int32(1),
+ },
+ sw.User{
+ Id: int64(1002),
+ FirstName: "gopher2",
+ LastName: "lang2",
+ Username: "gopher2",
+ Password: "lang2",
+ Email: "lang2@test.com",
+ Phone: "5101112222",
+ UserStatus: int32(1),
+ },
+ }
+
+ apiResponse, err := client.UserApi.CreateUsersWithArrayInput(context.Background(), newUsers)
+ if err != nil {
+ t.Fatalf("Error while adding users: %v", err)
+ }
+ if apiResponse.StatusCode != 200 {
+ t.Log(apiResponse)
+ }
+
+ //tear down
+ _, err1 := client.UserApi.DeleteUser(context.Background(), "gopher1")
+ if err1 != nil {
+ t.Errorf("Error while deleting user")
+ t.Log(err1)
+ }
+
+ _, err2 := client.UserApi.DeleteUser(context.Background(), "gopher2")
+ if err2 != nil {
+ t.Errorf("Error while deleting user")
+ t.Log(err2)
+ }
+}
+
+func TestGetUserByName(t *testing.T) {
+ assert := assert.New(t)
+
+ resp, apiResponse, err := client.UserApi.GetUserByName(context.Background(), "gopher")
+ if err != nil {
+ t.Fatalf("Error while getting user by id: %v", err)
+ } else {
+ assert.Equal(resp.Id, int64(1000), "User id should be equal")
+ assert.Equal(resp.Username, "gopher", "User name should be gopher")
+ assert.Equal(resp.LastName, "lang", "Last name should be lang")
+ //t.Log(resp)
+ }
+ if apiResponse.StatusCode != 200 {
+ t.Log(apiResponse)
+ }
+}
+
+func TestGetUserByNameWithInvalidID(t *testing.T) {
+ resp, apiResponse, err := client.UserApi.GetUserByName(context.Background(), "999999999")
+ if apiResponse != nil && apiResponse.StatusCode == 404 {
+ return // This is a pass condition. API will return with a 404 error.
+ } else if err != nil {
+ t.Fatalf("Error while getting user by invalid id: %v", err)
+ t.Log(apiResponse)
+ } else {
+ t.Log(resp)
+ }
+ if apiResponse.StatusCode != 200 {
+ t.Log(apiResponse)
+ }
+}
+
+func TestUpdateUser(t *testing.T) {
+ assert := assert.New(t)
+
+ newUser := sw.User{
+ Id: 1000,
+ FirstName: "gopher20",
+ LastName: "lang20",
+ Username: "gopher",
+ Password: "lang",
+ Email: "lang@test.com",
+ Phone: "5101112222",
+ UserStatus: 1}
+
+ apiResponse, err := client.UserApi.UpdateUser(context.Background(), "gopher", newUser)
+ if err != nil {
+ t.Fatalf("Error while deleting user by id: %v", err)
+ }
+ if apiResponse.StatusCode != 200 {
+ t.Log(apiResponse)
+ }
+
+ //verify changings are correct
+ resp, apiResponse, err := client.UserApi.GetUserByName(context.Background(), "gopher")
+ if err != nil {
+ t.Fatalf("Error while getting user by id: %v", err)
+ } else {
+ assert.Equal(resp.Id, int64(1000), "User id should be equal")
+ assert.Equal(resp.FirstName, "gopher20", "User name should be gopher")
+ assert.Equal(resp.Password, "lang", "User name should be the same")
+ }
+}
+
+func TestDeleteUser(t *testing.T) {
+ apiResponse, err := client.UserApi.DeleteUser(context.Background(), "gopher")
+
+ if err != nil {
+ t.Fatalf("Error while deleting user: %v", err)
+ }
+ if apiResponse.StatusCode != 200 {
+ t.Log(apiResponse)
+ }
+}
diff --git a/samples/client/petstore/go/pom.xml b/samples/client/petstore/go/pom.xml
index 082720066314..7b3edeff64dc 100644
--- a/samples/client/petstore/go/pom.xml
+++ b/samples/client/petstore/go/pom.xml
@@ -1,11 +1,11 @@
4.0.0
org.openapitools
- Goswagger
+ GoPetstore
pom
1.0.0
Go Petstore Client
-
+
maven-dependency-plugin