forked from loafle/openapi-generator-original
Merge pull request #261 from wing328/fix_go
Various fix for Go petstore client
This commit is contained in:
@@ -27,6 +27,6 @@ fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ generate -t modules/openapi-generator/src/main/resources/go -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l go -o samples/client/petstore/go/go-petstore -DpackageName=petstore "
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/go -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l go -o samples/client/petstore/go/go-petstore -DpackageName=petstore $@"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
||||
@@ -30,28 +30,43 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
||||
hideGenerationTimestamp = Boolean.FALSE;
|
||||
|
||||
defaultIncludes = new HashSet<String>(
|
||||
Arrays.asList(
|
||||
"map",
|
||||
"array")
|
||||
);
|
||||
Arrays.asList(
|
||||
"map",
|
||||
"array")
|
||||
);
|
||||
|
||||
setReservedWordsLowerCase(
|
||||
Arrays.asList(
|
||||
// data type
|
||||
"string", "bool", "uint", "uint8", "uint16", "uint32", "uint64",
|
||||
"int", "int8", "int16", "int32", "int64", "float32", "float64",
|
||||
"complex64", "complex128", "rune", "byte", "uintptr",
|
||||
|
||||
"break", "default", "func", "interface", "select",
|
||||
"case", "defer", "go", "map", "struct",
|
||||
"chan", "else", "goto", "package", "switch",
|
||||
"const", "fallthrough", "if", "range", "type",
|
||||
"continue", "for", "import", "return", "var", "error", "nil")
|
||||
// Added "error" as it's used so frequently that it may as well be a keyword
|
||||
);
|
||||
|
||||
languageSpecificPrimitives = new HashSet<String>(
|
||||
Arrays.asList(
|
||||
"string",
|
||||
"bool",
|
||||
"uint",
|
||||
"uint32",
|
||||
"uint64",
|
||||
"int",
|
||||
"int32",
|
||||
"int64",
|
||||
"float32",
|
||||
"float64",
|
||||
"complex64",
|
||||
"complex128",
|
||||
"rune",
|
||||
"byte")
|
||||
);
|
||||
Arrays.asList(
|
||||
"string",
|
||||
"bool",
|
||||
"uint",
|
||||
"uint32",
|
||||
"uint64",
|
||||
"int",
|
||||
"int32",
|
||||
"int64",
|
||||
"float32",
|
||||
"float64",
|
||||
"complex64",
|
||||
"complex128",
|
||||
"rune",
|
||||
"byte")
|
||||
);
|
||||
|
||||
instantiationTypes.clear();
|
||||
/*instantiationTypes.put("array", "GoArray");
|
||||
@@ -71,12 +86,9 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
||||
typeMapping.put("password", "string");
|
||||
typeMapping.put("File", "*os.File");
|
||||
typeMapping.put("file", "*os.File");
|
||||
// map binary to string as a workaround
|
||||
// the correct solution is to use []byte
|
||||
typeMapping.put("binary", "string");
|
||||
typeMapping.put("binary", "*os.File");
|
||||
typeMapping.put("ByteArray", "string");
|
||||
typeMapping.put("object", "interface{}");
|
||||
typeMapping.put("UUID", "string");
|
||||
|
||||
importMapping = new HashMap<String, String>();
|
||||
|
||||
@@ -126,9 +138,11 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
||||
// pet_id => PetId
|
||||
name = camelize(name);
|
||||
|
||||
// for reserved word or word starting with number, append _
|
||||
if (isReservedWord(name))
|
||||
// for reserved word append _
|
||||
if (isReservedWord(name)) {
|
||||
LOGGER.warn(name + " (reserved word) cannot be used as variable name. Renamed to "+ escapeReservedWord(name));
|
||||
name = escapeReservedWord(name);
|
||||
}
|
||||
|
||||
// for reserved word or word starting with number, append _
|
||||
if (name.matches("^\\d.*"))
|
||||
@@ -137,15 +151,27 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isReservedWord(String word) {
|
||||
return word != null && reservedWords.contains(word);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toParamName(String name) {
|
||||
// params should be lowerCamelCase. E.g. "person Person", instead of
|
||||
// "Person Person".
|
||||
//
|
||||
name = camelize(toVarName(name), true);
|
||||
|
||||
// REVISIT: Actually, for idiomatic go, the param name should
|
||||
// really should just be a letter, e.g. "p Person"), but we'll get
|
||||
// around to that some other time... Maybe.
|
||||
return camelize(toVarName(name), true);
|
||||
if (isReservedWord(name)) {
|
||||
LOGGER.warn(name + " (reserved word) cannot be used as parameter name. Renamed to "+ name + "_");
|
||||
name = name + "_";
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -196,39 +222,13 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
||||
return "api_" + underscore(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides postProcessParameter to add a vendor extension "x-exportParamName".
|
||||
* This is useful when paramName starts with a lowercase letter, but we need that
|
||||
* param to be exportable (starts with an Uppercase letter).
|
||||
*
|
||||
* @param parameter CodegenParameter object to be processed.
|
||||
*/
|
||||
@Override
|
||||
public void postProcessParameter(CodegenParameter parameter) {
|
||||
|
||||
// Give the base class a chance to process
|
||||
super.postProcessParameter(parameter);
|
||||
|
||||
char nameFirstChar = parameter.paramName.charAt(0);
|
||||
if (Character.isUpperCase(nameFirstChar)) {
|
||||
// First char is already uppercase, just use paramName.
|
||||
parameter.vendorExtensions.put("x-exportParamName", parameter.paramName);
|
||||
} else {
|
||||
// It's a lowercase first char, let's convert it to uppercase
|
||||
StringBuilder sb = new StringBuilder(parameter.paramName);
|
||||
sb.setCharAt(0, Character.toUpperCase(nameFirstChar));
|
||||
parameter.vendorExtensions.put("x-exportParamName", sb.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTypeDeclaration(Schema p) {
|
||||
if (ModelUtils.isArraySchema(p)) {
|
||||
ArraySchema ap = (ArraySchema) p;
|
||||
Schema inner = ap.getItems();
|
||||
return "[]" + getTypeDeclaration(inner);
|
||||
}
|
||||
else if (ModelUtils.isMapSchema(p)) {
|
||||
} else if (ModelUtils.isMapSchema(p)) {
|
||||
Schema inner = (Schema) p.getAdditionalProperties();
|
||||
return getSchemaType(p) + "[string]" + getTypeDeclaration(inner);
|
||||
}
|
||||
@@ -316,14 +316,14 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
||||
for (CodegenOperation operation : operations) {
|
||||
for (CodegenParameter param : operation.allParams) {
|
||||
// import "os" if the operation uses files
|
||||
if (!addedOSImport && param.dataType == "*os.File") {
|
||||
if (!addedOSImport && "*os.File".equals(param.dataType)) {
|
||||
imports.add(createMapping("import", "os"));
|
||||
addedOSImport = true;
|
||||
}
|
||||
|
||||
// import "time" if the operation has a required time parameter.
|
||||
if (param.required) {
|
||||
if (!addedTimeImport && param.dataType == "time.Time") {
|
||||
if (!addedTimeImport && "time.Time".equals(param.dataType)) {
|
||||
imports.add(createMapping("import", "time"));
|
||||
addedTimeImport = true;
|
||||
}
|
||||
@@ -336,15 +336,36 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
||||
addedOptionalImport = true;
|
||||
}
|
||||
// We need to specially map Time type to the optionals package
|
||||
if (param.dataType == "time.Time") {
|
||||
if ("time.Time".equals(param.dataType)) {
|
||||
param.vendorExtensions.put("x-optionalDataType", "Time");
|
||||
continue;
|
||||
} else {
|
||||
// Map optional type to dataType
|
||||
param.vendorExtensions.put("x-optionalDataType",
|
||||
param.dataType.substring(0, 1).toUpperCase() + param.dataType.substring(1));
|
||||
}
|
||||
// Map optional type to dataType
|
||||
param.vendorExtensions.put("x-optionalDataType",
|
||||
param.dataType.substring(0, 1).toUpperCase() + param.dataType.substring(1));
|
||||
}
|
||||
|
||||
// set x-exportParamName
|
||||
char nameFirstChar = param.paramName.charAt(0);
|
||||
if (Character.isUpperCase(nameFirstChar)) {
|
||||
// First char is already uppercase, just use paramName.
|
||||
param.vendorExtensions.put("x-exportParamName", param.paramName);
|
||||
} else {
|
||||
// It's a lowercase first char, let's convert it to uppercase
|
||||
StringBuilder sb = new StringBuilder(param.paramName);
|
||||
sb.setCharAt(0, Character.toUpperCase(nameFirstChar));
|
||||
param.vendorExtensions.put("x-exportParamName", sb.toString());
|
||||
}
|
||||
}
|
||||
|
||||
setExportParameterName(operation.queryParams);
|
||||
setExportParameterName(operation.formParams);
|
||||
setExportParameterName(operation.headerParams);
|
||||
setExportParameterName(operation.bodyParams);
|
||||
setExportParameterName(operation.cookieParams);
|
||||
setExportParameterName(operation.optionalParams);
|
||||
setExportParameterName(operation.requiredParams);
|
||||
|
||||
}
|
||||
|
||||
// recursively add import for mapping one type to multiple imports
|
||||
@@ -365,6 +386,21 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
||||
return objs;
|
||||
}
|
||||
|
||||
private void setExportParameterName(List<CodegenParameter> codegenParameters) {
|
||||
for (CodegenParameter param : codegenParameters) {
|
||||
char nameFirstChar = param.paramName.charAt(0);
|
||||
if (Character.isUpperCase(nameFirstChar)) {
|
||||
// First char is already uppercase, just use paramName.
|
||||
param.vendorExtensions.put("x-exportParamName", param.paramName);
|
||||
} else {
|
||||
// It's a lowercase first char, let's convert it to uppercase
|
||||
StringBuilder sb = new StringBuilder(param.paramName);
|
||||
sb.setCharAt(0, Character.toUpperCase(nameFirstChar));
|
||||
param.vendorExtensions.put("x-exportParamName", sb.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> postProcessModels(Map<String, Object> objs) {
|
||||
// remove model imports to avoid error
|
||||
@@ -385,11 +421,11 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
||||
if (v instanceof CodegenModel) {
|
||||
CodegenModel model = (CodegenModel) v;
|
||||
for (CodegenProperty param : model.vars) {
|
||||
if (!addedTimeImport && param.baseType == "time.Time") {
|
||||
if (!addedTimeImport && "time.Time".equals(param.baseType)) {
|
||||
imports.add(createMapping("import", "time"));
|
||||
addedTimeImport = true;
|
||||
}
|
||||
if (!addedOSImport && param.baseType == "*os.File") {
|
||||
if (!addedOSImport && "*os.File".equals(param.baseType)) {
|
||||
imports.add(createMapping("import", "os"));
|
||||
addedOSImport = true;
|
||||
}
|
||||
|
||||
@@ -35,21 +35,6 @@ public class GoClientCodegen extends AbstractGoCodegen {
|
||||
// default HIDE_GENERATION_TIMESTAMP to true
|
||||
hideGenerationTimestamp = Boolean.TRUE;
|
||||
|
||||
setReservedWordsLowerCase(
|
||||
Arrays.asList(
|
||||
// data type
|
||||
"string", "bool", "uint", "uint8", "uint16", "uint32", "uint64",
|
||||
"int", "int8", "int16", "int32", "int64", "float32", "float64",
|
||||
"complex64", "complex128", "rune", "byte", "uintptr",
|
||||
|
||||
"break", "default", "func", "interface", "select",
|
||||
"case", "defer", "go", "map", "struct",
|
||||
"chan", "else", "goto", "package", "switch",
|
||||
"const", "fallthrough", "if", "range", "type",
|
||||
"continue", "for", "import", "return", "var", "error", "ApiResponse", "nil")
|
||||
// Added "error" as it's used so frequently that it may as well be a keyword
|
||||
);
|
||||
|
||||
cliOptions.add(new CliOption(CodegenConstants.PACKAGE_VERSION, "Go package version.")
|
||||
.defaultValue("1.0.0"));
|
||||
cliOptions.add(CliOption.newBoolean(WITH_XML, "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)"));
|
||||
|
||||
@@ -21,19 +21,46 @@ type {{classname}}Service service
|
||||
{{#operation}}
|
||||
|
||||
/*
|
||||
{{{classname}}}Service{{#summary}} {{.}}{{/summary}}{{#notes}}
|
||||
{{notes}}{{/notes}}
|
||||
{{{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}}optional.{{vendorExtensions.x-optionalDataType}}{{/isPrimitiveType}}{{^isPrimitiveType}}optional.Interface of {{dataType}}{{/isPrimitiveType}}) - {{#description}} {{.}}{{/description}}
|
||||
{{/required}}{{/allParams}}{{/hasOptionalParams}}
|
||||
{{#returnType}}@return {{{returnType}}}{{/returnType}}
|
||||
{{#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}} {{vendorExtensions.x-exportParamName}} optional.{{vendorExtensions.x-optionalDataType}}{{/isPrimitiveType}}{{^isPrimitiveType}} {{vendorExtensions.x-exportParamName}} optional.Interface{{/isPrimitiveType}}{{/required}}{{/allParams}}
|
||||
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}}
|
||||
@@ -43,7 +70,9 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx context.Context{{#hasParams}
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
{{#returnType}}localVarReturnValue {{{returnType}}}{{/returnType}}
|
||||
{{#returnType}}
|
||||
localVarReturnValue {{{returnType}}}
|
||||
{{/returnType}}
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@@ -178,19 +207,25 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx context.Context{{#hasParams}
|
||||
{{/formParams}}
|
||||
{{/hasFormParams}}
|
||||
{{#hasBodyParam}}
|
||||
{{#bodyParams}} // body params
|
||||
{{#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}}})
|
||||
{{#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}}")
|
||||
return {{#returnType}}localVarReturnValue, {{/returnType}}nil, reportError("{{paramName}} should be {{dataType}}")
|
||||
}
|
||||
localVarPostBody = &localVarOptional{{vendorExtensions.x-exportParamName}}{{/isPrimitiveType}}
|
||||
localVarPostBody = &localVarOptional{{vendorExtensions.x-exportParamName}}
|
||||
{{/isPrimitiveType}}
|
||||
}
|
||||
|
||||
{{/required}}
|
||||
{{/bodyParams}}
|
||||
{{/hasBodyParam}}
|
||||
@@ -209,6 +244,7 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx context.Context{{#hasParams}
|
||||
{{#isKeyInQuery}}localVarQueryParams.Add("{{keyParamName}}", key){{/isKeyInQuery}}
|
||||
}
|
||||
}
|
||||
|
||||
{{/isApiKey}}
|
||||
{{/authMethods}}
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
@@ -235,14 +271,15 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx context.Context{{#hasParams}
|
||||
return {{#returnType}}localVarReturnValue, {{/returnType}}localVarHttpResponse, err
|
||||
}
|
||||
}
|
||||
{{/returnType}}
|
||||
|
||||
{{/returnType}}
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
{{#responses}}{{#dataType}}
|
||||
{{#responses}}
|
||||
{{#dataType}}
|
||||
if localVarHttpResponse.StatusCode == {{{code}}} {
|
||||
var v {{{dataType}}}
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
@@ -253,10 +290,12 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx context.Context{{#hasParams}
|
||||
newErr.model = v
|
||||
return {{#returnType}}localVarReturnValue, {{/returnType}}localVarHttpResponse, newErr
|
||||
}
|
||||
{{/dataType}}{{/responses}}
|
||||
{{/dataType}}
|
||||
{{/responses}}
|
||||
return {{#returnType}}localVarReturnValue, {{/returnType}}localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return {{#returnType}}localVarReturnValue, {{/returnType}}localVarHttpResponse, nil
|
||||
}
|
||||
{{/operation}}{{/operations}}
|
||||
{{/operation}}
|
||||
{{/operations}}
|
||||
@@ -1,10 +1,20 @@
|
||||
{{>partial_header}}
|
||||
package {{packageName}}
|
||||
{{#models}}{{#imports}}
|
||||
import ({{/imports}}{{#imports}}
|
||||
"{{import}}"{{/imports}}{{#imports}}
|
||||
{{#models}}
|
||||
{{#imports}}
|
||||
{{#-first}}
|
||||
import (
|
||||
{{/-first}}
|
||||
"{{import}}"
|
||||
{{#-last}}
|
||||
)
|
||||
{{/imports}}{{#model}}{{#isEnum}}{{#description}}// {{{classname}}} : {{{description}}}{{/description}}
|
||||
{{/-last}}
|
||||
{{/imports}}
|
||||
{{#model}}
|
||||
{{#isEnum}}
|
||||
{{#description}}
|
||||
// {{{classname}}} : {{{description}}}
|
||||
{{/description}}
|
||||
type {{{classname}}} {{^format}}{{dataType}}{{/format}}{{#format}}{{{format}}}{{/format}}
|
||||
|
||||
// List of {{{name}}}
|
||||
@@ -27,4 +37,7 @@ type {{classname}} struct {
|
||||
{{/description}}
|
||||
{{name}} {{^isEnum}}{{^isPrimitiveType}}{{^isContainer}}{{^isDateTime}}*{{/isDateTime}}{{/isContainer}}{{/isPrimitiveType}}{{/isEnum}}{{{datatype}}} `json:"{{baseName}}{{^required}},omitempty{{/required}}"{{#withXml}} xml:"{{baseName}}"{{/withXml}}`
|
||||
{{/vars}}
|
||||
}{{/isEnum}}{{/model}}{{/models}}
|
||||
}
|
||||
{{/isEnum}}
|
||||
{{/model}}
|
||||
{{/models}}
|
||||
@@ -60,6 +60,7 @@ Class | Method | HTTP request | Description
|
||||
- [AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md)
|
||||
- [Animal](docs/Animal.md)
|
||||
- [AnimalFarm](docs/AnimalFarm.md)
|
||||
- [ApiResponse](docs/ApiResponse.md)
|
||||
- [ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md)
|
||||
- [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md)
|
||||
- [ArrayTest](docs/ArrayTest.md)
|
||||
@@ -78,18 +79,14 @@ Class | Method | HTTP request | Description
|
||||
- [MapTest](docs/MapTest.md)
|
||||
- [MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md)
|
||||
- [Model200Response](docs/Model200Response.md)
|
||||
- [ModelApiResponse](docs/ModelApiResponse.md)
|
||||
- [ModelReturn](docs/ModelReturn.md)
|
||||
- [Name](docs/Name.md)
|
||||
- [NumberOnly](docs/NumberOnly.md)
|
||||
- [Order](docs/Order.md)
|
||||
- [OuterBoolean](docs/OuterBoolean.md)
|
||||
- [OuterComposite](docs/OuterComposite.md)
|
||||
- [OuterEnum](docs/OuterEnum.md)
|
||||
- [OuterNumber](docs/OuterNumber.md)
|
||||
- [OuterString](docs/OuterString.md)
|
||||
- [Pet](docs/Pet.md)
|
||||
- [ReadOnlyFirst](docs/ReadOnlyFirst.md)
|
||||
- [Return](docs/Return.md)
|
||||
- [SpecialModelName](docs/SpecialModelName.md)
|
||||
- [Tag](docs/Tag.md)
|
||||
- [User](docs/User.md)
|
||||
|
||||
@@ -107,11 +107,11 @@ paths:
|
||||
type: "array"
|
||||
items:
|
||||
type: "string"
|
||||
default: "available"
|
||||
enum:
|
||||
- "available"
|
||||
- "pending"
|
||||
- "sold"
|
||||
default: "available"
|
||||
collectionFormat: "csv"
|
||||
x-exportParamName: "Status"
|
||||
responses:
|
||||
@@ -216,12 +216,14 @@ paths:
|
||||
required: false
|
||||
type: "string"
|
||||
x-exportParamName: "Name"
|
||||
x-optionalDataType: "String"
|
||||
- name: "status"
|
||||
in: "formData"
|
||||
description: "Updated status of the pet"
|
||||
required: false
|
||||
type: "string"
|
||||
x-exportParamName: "Status"
|
||||
x-optionalDataType: "String"
|
||||
responses:
|
||||
405:
|
||||
description: "Invalid input"
|
||||
@@ -244,6 +246,7 @@ paths:
|
||||
required: false
|
||||
type: "string"
|
||||
x-exportParamName: "ApiKey"
|
||||
x-optionalDataType: "String"
|
||||
- name: "petId"
|
||||
in: "path"
|
||||
description: "Pet id to delete"
|
||||
@@ -283,6 +286,7 @@ paths:
|
||||
required: false
|
||||
type: "string"
|
||||
x-exportParamName: "AdditionalMetadata"
|
||||
x-optionalDataType: "String"
|
||||
- name: "file"
|
||||
in: "formData"
|
||||
description: "file to upload"
|
||||
@@ -498,7 +502,7 @@ paths:
|
||||
X-Expires-After:
|
||||
type: "string"
|
||||
format: "date-time"
|
||||
description: "date in UTC when toekn expires"
|
||||
description: "date in UTC when token expires"
|
||||
400:
|
||||
description: "Invalid username/password supplied"
|
||||
/user/logout:
|
||||
@@ -528,7 +532,7 @@ paths:
|
||||
parameters:
|
||||
- name: "username"
|
||||
in: "path"
|
||||
description: "The name that needs to be fetched. Use user1 for testing. "
|
||||
description: "The name that needs to be fetched. Use user1 for testing."
|
||||
required: true
|
||||
type: "string"
|
||||
x-exportParamName: "Username"
|
||||
@@ -595,6 +599,7 @@ paths:
|
||||
tags:
|
||||
- "fake_classname_tags 123#$%^"
|
||||
summary: "To test class name in snake case"
|
||||
description: "To test class name in snake case"
|
||||
operationId: "testClassname"
|
||||
consumes:
|
||||
- "application/json"
|
||||
@@ -634,10 +639,10 @@ paths:
|
||||
type: "array"
|
||||
items:
|
||||
type: "string"
|
||||
default: "$"
|
||||
enum:
|
||||
- ">"
|
||||
- "$"
|
||||
default: "$"
|
||||
x-exportParamName: "EnumFormStringArray"
|
||||
- name: "enum_form_string"
|
||||
in: "formData"
|
||||
@@ -650,6 +655,7 @@ paths:
|
||||
- "-efg"
|
||||
- "(xyz)"
|
||||
x-exportParamName: "EnumFormString"
|
||||
x-optionalDataType: "String"
|
||||
- name: "enum_header_string_array"
|
||||
in: "header"
|
||||
description: "Header parameter enum test (string array)"
|
||||
@@ -657,10 +663,10 @@ paths:
|
||||
type: "array"
|
||||
items:
|
||||
type: "string"
|
||||
default: "$"
|
||||
enum:
|
||||
- ">"
|
||||
- "$"
|
||||
default: "$"
|
||||
x-exportParamName: "EnumHeaderStringArray"
|
||||
- name: "enum_header_string"
|
||||
in: "header"
|
||||
@@ -673,6 +679,7 @@ paths:
|
||||
- "-efg"
|
||||
- "(xyz)"
|
||||
x-exportParamName: "EnumHeaderString"
|
||||
x-optionalDataType: "String"
|
||||
- name: "enum_query_string_array"
|
||||
in: "query"
|
||||
description: "Query parameter enum test (string array)"
|
||||
@@ -680,10 +687,10 @@ paths:
|
||||
type: "array"
|
||||
items:
|
||||
type: "string"
|
||||
default: "$"
|
||||
enum:
|
||||
- ">"
|
||||
- "$"
|
||||
default: "$"
|
||||
x-exportParamName: "EnumQueryStringArray"
|
||||
- name: "enum_query_string"
|
||||
in: "query"
|
||||
@@ -696,6 +703,7 @@ paths:
|
||||
- "-efg"
|
||||
- "(xyz)"
|
||||
x-exportParamName: "EnumQueryString"
|
||||
x-optionalDataType: "String"
|
||||
- name: "enum_query_integer"
|
||||
in: "query"
|
||||
description: "Query parameter enum test (double)"
|
||||
@@ -706,6 +714,7 @@ paths:
|
||||
- 1
|
||||
- -2
|
||||
x-exportParamName: "EnumQueryInteger"
|
||||
x-optionalDataType: "Int32"
|
||||
- name: "enum_query_double"
|
||||
in: "formData"
|
||||
description: "Query parameter enum test (double)"
|
||||
@@ -716,6 +725,7 @@ paths:
|
||||
- 1.1
|
||||
- -1.2
|
||||
x-exportParamName: "EnumQueryDouble"
|
||||
x-optionalDataType: "Float64"
|
||||
responses:
|
||||
400:
|
||||
description: "Invalid request"
|
||||
@@ -744,6 +754,7 @@ paths:
|
||||
maximum: 100
|
||||
minimum: 10
|
||||
x-exportParamName: "Integer"
|
||||
x-optionalDataType: "Int32"
|
||||
- name: "int32"
|
||||
in: "formData"
|
||||
description: "None"
|
||||
@@ -753,6 +764,7 @@ paths:
|
||||
minimum: 20
|
||||
format: "int32"
|
||||
x-exportParamName: "Int32_"
|
||||
x-optionalDataType: "Int32"
|
||||
- name: "int64"
|
||||
in: "formData"
|
||||
description: "None"
|
||||
@@ -760,6 +772,7 @@ paths:
|
||||
type: "integer"
|
||||
format: "int64"
|
||||
x-exportParamName: "Int64_"
|
||||
x-optionalDataType: "Int64"
|
||||
- name: "number"
|
||||
in: "formData"
|
||||
description: "None"
|
||||
@@ -776,6 +789,7 @@ paths:
|
||||
maximum: 987.6
|
||||
format: "float"
|
||||
x-exportParamName: "Float"
|
||||
x-optionalDataType: "Float32"
|
||||
- name: "double"
|
||||
in: "formData"
|
||||
description: "None"
|
||||
@@ -792,6 +806,7 @@ paths:
|
||||
type: "string"
|
||||
pattern: "/[a-z]/i"
|
||||
x-exportParamName: "String_"
|
||||
x-optionalDataType: "String"
|
||||
- name: "pattern_without_delimiter"
|
||||
in: "formData"
|
||||
description: "None"
|
||||
@@ -813,6 +828,7 @@ paths:
|
||||
type: "string"
|
||||
format: "binary"
|
||||
x-exportParamName: "Binary"
|
||||
x-optionalDataType: "String"
|
||||
- name: "date"
|
||||
in: "formData"
|
||||
description: "None"
|
||||
@@ -820,6 +836,7 @@ paths:
|
||||
type: "string"
|
||||
format: "date"
|
||||
x-exportParamName: "Date"
|
||||
x-optionalDataType: "String"
|
||||
- name: "dateTime"
|
||||
in: "formData"
|
||||
description: "None"
|
||||
@@ -827,6 +844,7 @@ paths:
|
||||
type: "string"
|
||||
format: "date-time"
|
||||
x-exportParamName: "DateTime"
|
||||
x-optionalDataType: "Time"
|
||||
- name: "password"
|
||||
in: "formData"
|
||||
description: "None"
|
||||
@@ -836,12 +854,14 @@ paths:
|
||||
minLength: 10
|
||||
format: "password"
|
||||
x-exportParamName: "Password"
|
||||
x-optionalDataType: "String"
|
||||
- name: "callback"
|
||||
in: "formData"
|
||||
description: "None"
|
||||
required: false
|
||||
type: "string"
|
||||
x-exportParamName: "Callback"
|
||||
x-optionalDataType: "String"
|
||||
responses:
|
||||
400:
|
||||
description: "Invalid username supplied"
|
||||
@@ -995,6 +1015,28 @@ paths:
|
||||
responses:
|
||||
200:
|
||||
description: "successful operation"
|
||||
/fake/body-with-query-params:
|
||||
put:
|
||||
tags:
|
||||
- "fake"
|
||||
operationId: "testBodyWithQueryParams"
|
||||
consumes:
|
||||
- "application/json"
|
||||
parameters:
|
||||
- in: "body"
|
||||
name: "body"
|
||||
required: true
|
||||
schema:
|
||||
$ref: "#/definitions/User"
|
||||
x-exportParamName: "Body"
|
||||
- name: "query"
|
||||
in: "query"
|
||||
required: true
|
||||
type: "string"
|
||||
x-exportParamName: "Query"
|
||||
responses:
|
||||
200:
|
||||
description: "Success"
|
||||
/another-fake/dummy:
|
||||
patch:
|
||||
tags:
|
||||
@@ -1344,6 +1386,8 @@ definitions:
|
||||
default: "-efg"
|
||||
Enum_Test:
|
||||
type: "object"
|
||||
required:
|
||||
- "enum_string_required"
|
||||
properties:
|
||||
enum_string:
|
||||
type: "string"
|
||||
@@ -1351,6 +1395,12 @@ definitions:
|
||||
- "UPPER"
|
||||
- "lower"
|
||||
- ""
|
||||
enum_string_required:
|
||||
type: "string"
|
||||
enum:
|
||||
- "UPPER"
|
||||
- "lower"
|
||||
- ""
|
||||
enum_integer:
|
||||
type: "integer"
|
||||
format: "int32"
|
||||
|
||||
@@ -30,7 +30,6 @@ AnotherFakeApiService To test special tags
|
||||
To test special tags
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param client client model
|
||||
|
||||
@return Client
|
||||
*/
|
||||
func (a *AnotherFakeApiService) TestSpecialTags(ctx context.Context, client Client) (Client, *http.Response, error) {
|
||||
@@ -97,7 +96,6 @@ func (a *AnotherFakeApiService) TestSpecialTags(ctx context.Context, client Clie
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode == 200 {
|
||||
var v Client
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
@@ -108,7 +106,6 @@ func (a *AnotherFakeApiService) TestSpecialTags(ctx context.Context, client Clie
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
|
||||
@@ -32,22 +32,21 @@ 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 "" (optional.Bool) - Input boolean as post body
|
||||
|
||||
@return OuterBoolean
|
||||
* @param "BooleanPostBody" (optional.Bool) - Input boolean as post body
|
||||
@return bool
|
||||
*/
|
||||
|
||||
type FakeOuterBooleanSerializeOpts struct {
|
||||
optional.Bool
|
||||
type FakeOuterBooleanSerializeOpts struct {
|
||||
BooleanPostBody optional.Bool
|
||||
}
|
||||
|
||||
func (a *FakeApiService) FakeOuterBooleanSerialize(ctx context.Context, localVarOptionals *FakeOuterBooleanSerializeOpts) (OuterBoolean, *http.Response, error) {
|
||||
func (a *FakeApiService) FakeOuterBooleanSerialize(ctx context.Context, localVarOptionals *FakeOuterBooleanSerializeOpts) (bool, *http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Post")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
localVarReturnValue OuterBoolean
|
||||
localVarReturnValue bool
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@@ -75,10 +74,10 @@ func (a *FakeApiService) FakeOuterBooleanSerialize(ctx context.Context, localVar
|
||||
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
// body params
|
||||
if localVarOptionals != nil && localVarOptionals..IsSet() {
|
||||
localVarPostBody = &localVarOptionals..Value()
|
||||
|
||||
if localVarOptionals != nil && localVarOptionals.BooleanPostBody.IsSet() {
|
||||
localVarPostBody = localVarOptionals.BooleanPostBody.Value()
|
||||
}
|
||||
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, err
|
||||
@@ -108,9 +107,8 @@ func (a *FakeApiService) FakeOuterBooleanSerialize(ctx context.Context, localVar
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode == 200 {
|
||||
var v OuterBoolean
|
||||
var v bool
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
@@ -119,7 +117,6 @@ func (a *FakeApiService) FakeOuterBooleanSerialize(ctx context.Context, localVar
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
@@ -131,13 +128,12 @@ 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 "" (optional.Interface of OuterComposite) - Input composite as post body
|
||||
|
||||
* @param "OuterComposite" (optional.Interface of OuterComposite) - Input composite as post body
|
||||
@return OuterComposite
|
||||
*/
|
||||
|
||||
type FakeOuterCompositeSerializeOpts struct {
|
||||
optional.Interface
|
||||
type FakeOuterCompositeSerializeOpts struct {
|
||||
OuterComposite optional.Interface
|
||||
}
|
||||
|
||||
func (a *FakeApiService) FakeOuterCompositeSerialize(ctx context.Context, localVarOptionals *FakeOuterCompositeSerializeOpts) (OuterComposite, *http.Response, error) {
|
||||
@@ -174,14 +170,14 @@ func (a *FakeApiService) FakeOuterCompositeSerialize(ctx context.Context, localV
|
||||
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
// body params
|
||||
if localVarOptionals != nil && localVarOptionals..IsSet() {
|
||||
|
||||
localVarOptional, localVarOptionalok := localVarOptionals..Value().(OuterComposite)
|
||||
if !localVarOptionalok {
|
||||
return localVarReturnValue, nil, reportError("outerComposite should be OuterComposite")
|
||||
if localVarOptionals != nil && localVarOptionals.OuterComposite.IsSet() {
|
||||
localVarOptionalOuterComposite, localVarOptionalOuterCompositeok := localVarOptionals.OuterComposite.Value().(OuterComposite)
|
||||
if !localVarOptionalOuterCompositeok {
|
||||
return localVarReturnValue, nil, reportError("outerComposite should be OuterComposite")
|
||||
}
|
||||
localVarPostBody = &localVarOptional
|
||||
localVarPostBody = &localVarOptionalOuterComposite
|
||||
}
|
||||
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, err
|
||||
@@ -211,7 +207,6 @@ func (a *FakeApiService) FakeOuterCompositeSerialize(ctx context.Context, localV
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode == 200 {
|
||||
var v OuterComposite
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
@@ -222,7 +217,6 @@ func (a *FakeApiService) FakeOuterCompositeSerialize(ctx context.Context, localV
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
@@ -234,22 +228,21 @@ 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 "" (optional.Float32) - Input number as post body
|
||||
|
||||
@return OuterNumber
|
||||
* @param "Body" (optional.Float32) - Input number as post body
|
||||
@return float32
|
||||
*/
|
||||
|
||||
type FakeOuterNumberSerializeOpts struct {
|
||||
optional.Float32
|
||||
type FakeOuterNumberSerializeOpts struct {
|
||||
Body optional.Float32
|
||||
}
|
||||
|
||||
func (a *FakeApiService) FakeOuterNumberSerialize(ctx context.Context, localVarOptionals *FakeOuterNumberSerializeOpts) (OuterNumber, *http.Response, error) {
|
||||
func (a *FakeApiService) FakeOuterNumberSerialize(ctx context.Context, localVarOptionals *FakeOuterNumberSerializeOpts) (float32, *http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Post")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
localVarReturnValue OuterNumber
|
||||
localVarReturnValue float32
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@@ -277,10 +270,10 @@ func (a *FakeApiService) FakeOuterNumberSerialize(ctx context.Context, localVarO
|
||||
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
// body params
|
||||
if localVarOptionals != nil && localVarOptionals..IsSet() {
|
||||
localVarPostBody = &localVarOptionals..Value()
|
||||
|
||||
if localVarOptionals != nil && localVarOptionals.Body.IsSet() {
|
||||
localVarPostBody = localVarOptionals.Body.Value()
|
||||
}
|
||||
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, err
|
||||
@@ -310,9 +303,8 @@ func (a *FakeApiService) FakeOuterNumberSerialize(ctx context.Context, localVarO
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode == 200 {
|
||||
var v OuterNumber
|
||||
var v float32
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
@@ -321,7 +313,6 @@ func (a *FakeApiService) FakeOuterNumberSerialize(ctx context.Context, localVarO
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
@@ -333,22 +324,21 @@ 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 "" (optional.String) - Input string as post body
|
||||
|
||||
@return OuterString
|
||||
* @param "Body" (optional.String) - Input string as post body
|
||||
@return string
|
||||
*/
|
||||
|
||||
type FakeOuterStringSerializeOpts struct {
|
||||
optional.String
|
||||
type FakeOuterStringSerializeOpts struct {
|
||||
Body optional.String
|
||||
}
|
||||
|
||||
func (a *FakeApiService) FakeOuterStringSerialize(ctx context.Context, localVarOptionals *FakeOuterStringSerializeOpts) (OuterString, *http.Response, error) {
|
||||
func (a *FakeApiService) FakeOuterStringSerialize(ctx context.Context, localVarOptionals *FakeOuterStringSerializeOpts) (string, *http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Post")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
localVarReturnValue OuterString
|
||||
localVarReturnValue string
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@@ -376,10 +366,10 @@ func (a *FakeApiService) FakeOuterStringSerialize(ctx context.Context, localVarO
|
||||
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
// body params
|
||||
if localVarOptionals != nil && localVarOptionals..IsSet() {
|
||||
localVarPostBody = &localVarOptionals..Value()
|
||||
|
||||
if localVarOptionals != nil && localVarOptionals.Body.IsSet() {
|
||||
localVarPostBody = localVarOptionals.Body.Value()
|
||||
}
|
||||
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, err
|
||||
@@ -409,9 +399,8 @@ func (a *FakeApiService) FakeOuterStringSerialize(ctx context.Context, localVarO
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode == 200 {
|
||||
var v OuterString
|
||||
var v string
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
@@ -420,7 +409,6 @@ func (a *FakeApiService) FakeOuterStringSerialize(ctx context.Context, localVarO
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
@@ -432,8 +420,6 @@ FakeApiService
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param query
|
||||
* @param user
|
||||
|
||||
|
||||
*/
|
||||
func (a *FakeApiService) TestBodyWithQueryParams(ctx context.Context, query string, user User) (*http.Response, error) {
|
||||
var (
|
||||
@@ -441,7 +427,6 @@ func (a *FakeApiService) TestBodyWithQueryParams(ctx context.Context, query stri
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@@ -451,7 +436,7 @@ func (a *FakeApiService) TestBodyWithQueryParams(ctx context.Context, query stri
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
localVarQueryParams.Add("query", parameterToString(query, "csv"))
|
||||
localVarQueryParams.Add("query", parameterToString(query, ""))
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{"application/json"}
|
||||
|
||||
@@ -487,13 +472,11 @@ func (a *FakeApiService) TestBodyWithQueryParams(ctx context.Context, query stri
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
return localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
@@ -505,7 +488,6 @@ 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 client client model
|
||||
|
||||
@return Client
|
||||
*/
|
||||
func (a *FakeApiService) TestClientModel(ctx context.Context, client Client) (Client, *http.Response, error) {
|
||||
@@ -572,7 +554,6 @@ func (a *FakeApiService) TestClientModel(ctx context.Context, client Client) (Cl
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode == 200 {
|
||||
var v Client
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
@@ -583,7 +564,6 @@ func (a *FakeApiService) TestClientModel(ctx context.Context, client Client) (Cl
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
@@ -597,42 +577,39 @@ Fake endpoint for testing various parameters 假端點 偽のエンドポイン
|
||||
* @param number None
|
||||
* @param double None
|
||||
* @param patternWithoutDelimiter None
|
||||
* @param byte None
|
||||
* @param byte_ None
|
||||
* @param optional nil or *TestEndpointParametersOpts - Optional Parameters:
|
||||
* @param "" (optional.Int32) - None
|
||||
* @param "" (optional.Int32) - None
|
||||
* @param "" (optional.Int64) - None
|
||||
* @param "" (optional.Float32) - None
|
||||
* @param "" (optional.String) - None
|
||||
* @param "" (optional.*os.File) - None
|
||||
* @param "" (optional.String) - None
|
||||
* @param "" (optional.Time) - None
|
||||
* @param "" (optional.String) - None
|
||||
* @param "" (optional.String) - None
|
||||
|
||||
|
||||
* @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 {
|
||||
optional.Int32
|
||||
optional.Int32
|
||||
optional.Int64
|
||||
optional.Float32
|
||||
optional.String
|
||||
optional.*os.File
|
||||
optional.String
|
||||
optional.Time
|
||||
optional.String
|
||||
optional.String
|
||||
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) {
|
||||
func (a *FakeApiService) TestEndpointParameters(ctx context.Context, number float32, double float64, patternWithoutDelimiter string, byte_ string, localVarOptionals *TestEndpointParametersOpts) (*http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Post")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@@ -671,29 +648,29 @@ func (a *FakeApiService) TestEndpointParameters(ctx context.Context, number floa
|
||||
if localVarHttpHeaderAccept != "" {
|
||||
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
if localVarOptionals != nil && localVarOptionals..IsSet() {
|
||||
localVarFormParams.Add("integer", parameterToString(localVarOptionals..Value(), ""))
|
||||
if localVarOptionals != nil && localVarOptionals.Integer.IsSet() {
|
||||
localVarFormParams.Add("integer", parameterToString(localVarOptionals.Integer.Value(), ""))
|
||||
}
|
||||
if localVarOptionals != nil && localVarOptionals..IsSet() {
|
||||
localVarFormParams.Add("int32", parameterToString(localVarOptionals..Value(), ""))
|
||||
if localVarOptionals != nil && localVarOptionals.Int32_.IsSet() {
|
||||
localVarFormParams.Add("int32", parameterToString(localVarOptionals.Int32_.Value(), ""))
|
||||
}
|
||||
if localVarOptionals != nil && localVarOptionals..IsSet() {
|
||||
localVarFormParams.Add("int64", parameterToString(localVarOptionals..Value(), ""))
|
||||
if localVarOptionals != nil && localVarOptionals.Int64_.IsSet() {
|
||||
localVarFormParams.Add("int64", parameterToString(localVarOptionals.Int64_.Value(), ""))
|
||||
}
|
||||
localVarFormParams.Add("number", parameterToString(number, ""))
|
||||
if localVarOptionals != nil && localVarOptionals..IsSet() {
|
||||
localVarFormParams.Add("float", parameterToString(localVarOptionals..Value(), ""))
|
||||
if localVarOptionals != nil && localVarOptionals.Float.IsSet() {
|
||||
localVarFormParams.Add("float", parameterToString(localVarOptionals.Float.Value(), ""))
|
||||
}
|
||||
localVarFormParams.Add("double", parameterToString(double, ""))
|
||||
if localVarOptionals != nil && localVarOptionals..IsSet() {
|
||||
localVarFormParams.Add("string", parameterToString(localVarOptionals..Value(), ""))
|
||||
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, ""))
|
||||
localVarFormParams.Add("byte", parameterToString(byte_, ""))
|
||||
var localVarFile *os.File
|
||||
if localVarOptionals != nil && localVarOptionals..IsSet() {
|
||||
if localVarOptionals != nil && localVarOptionals.Binary.IsSet() {
|
||||
localVarFileOk := false
|
||||
localVarFile, localVarFileOk = localVarOptionals..Value().(*os.File)
|
||||
localVarFile, localVarFileOk = localVarOptionals.Binary.Value().(*os.File)
|
||||
if !localVarFileOk {
|
||||
return nil, reportError("binary should be *os.File")
|
||||
}
|
||||
@@ -704,17 +681,17 @@ func (a *FakeApiService) TestEndpointParameters(ctx context.Context, number floa
|
||||
localVarFileName = localVarFile.Name()
|
||||
localVarFile.Close()
|
||||
}
|
||||
if localVarOptionals != nil && localVarOptionals..IsSet() {
|
||||
localVarFormParams.Add("date", parameterToString(localVarOptionals..Value(), ""))
|
||||
if localVarOptionals != nil && localVarOptionals.Date.IsSet() {
|
||||
localVarFormParams.Add("date", parameterToString(localVarOptionals.Date.Value(), ""))
|
||||
}
|
||||
if localVarOptionals != nil && localVarOptionals..IsSet() {
|
||||
localVarFormParams.Add("dateTime", parameterToString(localVarOptionals..Value(), ""))
|
||||
if localVarOptionals != nil && localVarOptionals.DateTime.IsSet() {
|
||||
localVarFormParams.Add("dateTime", parameterToString(localVarOptionals.DateTime.Value(), ""))
|
||||
}
|
||||
if localVarOptionals != nil && localVarOptionals..IsSet() {
|
||||
localVarFormParams.Add("password", parameterToString(localVarOptionals..Value(), ""))
|
||||
if localVarOptionals != nil && localVarOptionals.Password.IsSet() {
|
||||
localVarFormParams.Add("password", parameterToString(localVarOptionals.Password.Value(), ""))
|
||||
}
|
||||
if localVarOptionals != nil && localVarOptionals..IsSet() {
|
||||
localVarFormParams.Add("callback", parameterToString(localVarOptionals..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, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
@@ -732,13 +709,11 @@ func (a *FakeApiService) TestEndpointParameters(ctx context.Context, number floa
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
return localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
@@ -750,27 +725,25 @@ 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 "" (optional.Interface of []string) - Form parameter enum test (string array)
|
||||
* @param "" (optional.String) - Form parameter enum test (string)
|
||||
|
||||
|
||||
* @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
|
||||
optional.Interface
|
||||
optional.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) {
|
||||
@@ -779,7 +752,6 @@ func (a *FakeApiService) TestEnumParameters(ctx context.Context, localVarOptiona
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@@ -793,13 +765,13 @@ func (a *FakeApiService) TestEnumParameters(ctx context.Context, localVarOptiona
|
||||
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(), "csv"))
|
||||
localVarQueryParams.Add("enum_query_string", parameterToString(localVarOptionals.EnumQueryString.Value(), ""))
|
||||
}
|
||||
if localVarOptionals != nil && localVarOptionals.EnumQueryInteger.IsSet() {
|
||||
localVarQueryParams.Add("enum_query_integer", parameterToString(localVarOptionals.EnumQueryInteger.Value(), "csv"))
|
||||
localVarQueryParams.Add("enum_query_integer", parameterToString(localVarOptionals.EnumQueryInteger.Value(), ""))
|
||||
}
|
||||
if localVarOptionals != nil && localVarOptionals.EnumQueryDouble.IsSet() {
|
||||
localVarQueryParams.Add("enum_query_double", parameterToString(localVarOptionals.EnumQueryDouble.Value(), "csv"))
|
||||
localVarQueryParams.Add("enum_query_double", parameterToString(localVarOptionals.EnumQueryDouble.Value(), ""))
|
||||
}
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{"application/x-www-form-urlencoded"}
|
||||
@@ -822,13 +794,13 @@ func (a *FakeApiService) TestEnumParameters(ctx context.Context, localVarOptiona
|
||||
localVarHeaderParams["enum_header_string_array"] = parameterToString(localVarOptionals.EnumHeaderStringArray.Value(), "csv")
|
||||
}
|
||||
if localVarOptionals != nil && localVarOptionals.EnumHeaderString.IsSet() {
|
||||
localVarHeaderParams["enum_header_string"] = parameterToString(localVarOptionals.EnumHeaderString.Value(), "csv")
|
||||
localVarHeaderParams["enum_header_string"] = parameterToString(localVarOptionals.EnumHeaderString.Value(), "")
|
||||
}
|
||||
if localVarOptionals != nil && localVarOptionals..IsSet() {
|
||||
localVarFormParams.Add("enum_form_string_array", parameterToString(localVarOptionals..Value(), ""))
|
||||
if localVarOptionals != nil && localVarOptionals.EnumFormStringArray.IsSet() {
|
||||
localVarFormParams.Add("enum_form_string_array", parameterToString(localVarOptionals.EnumFormStringArray.Value(), ""))
|
||||
}
|
||||
if localVarOptionals != nil && localVarOptionals..IsSet() {
|
||||
localVarFormParams.Add("enum_form_string", parameterToString(localVarOptionals..Value(), ""))
|
||||
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, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
@@ -846,13 +818,11 @@ func (a *FakeApiService) TestEnumParameters(ctx context.Context, localVarOptiona
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
return localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
@@ -863,8 +833,6 @@ func (a *FakeApiService) TestEnumParameters(ctx context.Context, localVarOptiona
|
||||
FakeApiService test inline additionalProperties
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param requestBody request body
|
||||
|
||||
|
||||
*/
|
||||
func (a *FakeApiService) TestInlineAdditionalProperties(ctx context.Context, requestBody string) (*http.Response, error) {
|
||||
var (
|
||||
@@ -872,7 +840,6 @@ func (a *FakeApiService) TestInlineAdditionalProperties(ctx context.Context, req
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@@ -917,13 +884,11 @@ func (a *FakeApiService) TestInlineAdditionalProperties(ctx context.Context, req
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
return localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
@@ -935,8 +900,6 @@ 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 (
|
||||
@@ -944,7 +907,6 @@ func (a *FakeApiService) TestJsonFormData(ctx context.Context, param string, par
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@@ -989,13 +951,11 @@ func (a *FakeApiService) TestJsonFormData(ctx context.Context, param string, par
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
return localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@ 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 client client model
|
||||
|
||||
@return Client
|
||||
*/
|
||||
func (a *FakeClassnameTags123ApiService) TestClassname(ctx context.Context, client Client) (Client, *http.Response, error) {
|
||||
@@ -81,6 +80,7 @@ func (a *FakeClassnameTags123ApiService) TestClassname(ctx context.Context, clie
|
||||
localVarQueryParams.Add("api_key_query", key)
|
||||
}
|
||||
}
|
||||
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, err
|
||||
@@ -110,7 +110,6 @@ func (a *FakeClassnameTags123ApiService) TestClassname(ctx context.Context, clie
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode == 200 {
|
||||
var v Client
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
@@ -121,7 +120,6 @@ func (a *FakeClassnameTags123ApiService) TestClassname(ctx context.Context, clie
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
|
||||
@@ -32,8 +32,6 @@ 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 pet Pet object that needs to be added to the store
|
||||
|
||||
|
||||
*/
|
||||
func (a *PetApiService) AddPet(ctx context.Context, pet Pet) (*http.Response, error) {
|
||||
var (
|
||||
@@ -41,7 +39,6 @@ func (a *PetApiService) AddPet(ctx context.Context, pet Pet) (*http.Response, er
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@@ -86,13 +83,11 @@ func (a *PetApiService) AddPet(ctx context.Context, pet Pet) (*http.Response, er
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
return localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
@@ -104,13 +99,11 @@ 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) -
|
||||
|
||||
|
||||
* @param "ApiKey" (optional.String) -
|
||||
*/
|
||||
|
||||
type DeletePetOpts struct {
|
||||
ApiKey optional.String
|
||||
type DeletePetOpts struct {
|
||||
ApiKey optional.String
|
||||
}
|
||||
|
||||
func (a *PetApiService) DeletePet(ctx context.Context, petId int64, localVarOptionals *DeletePetOpts) (*http.Response, error) {
|
||||
@@ -119,7 +112,6 @@ func (a *PetApiService) DeletePet(ctx context.Context, petId int64, localVarOpti
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@@ -148,7 +140,7 @@ func (a *PetApiService) DeletePet(ctx context.Context, petId int64, localVarOpti
|
||||
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
if localVarOptionals != nil && localVarOptionals.ApiKey.IsSet() {
|
||||
localVarHeaderParams["api_key"] = parameterToString(localVarOptionals.ApiKey.Value(), "csv")
|
||||
localVarHeaderParams["api_key"] = parameterToString(localVarOptionals.ApiKey.Value(), "")
|
||||
}
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
@@ -166,13 +158,11 @@ func (a *PetApiService) DeletePet(ctx context.Context, petId int64, localVarOpti
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
return localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
@@ -184,7 +174,6 @@ 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) {
|
||||
@@ -250,7 +239,6 @@ func (a *PetApiService) FindPetsByStatus(ctx context.Context, status []string) (
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode == 200 {
|
||||
var v []Pet
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
@@ -261,7 +249,6 @@ func (a *PetApiService) FindPetsByStatus(ctx context.Context, status []string) (
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
@@ -273,7 +260,6 @@ 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) {
|
||||
@@ -339,7 +325,6 @@ func (a *PetApiService) FindPetsByTags(ctx context.Context, tags []string) ([]Pe
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode == 200 {
|
||||
var v []Pet
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
@@ -350,7 +335,6 @@ func (a *PetApiService) FindPetsByTags(ctx context.Context, tags []string) ([]Pe
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
@@ -362,7 +346,6 @@ 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) {
|
||||
@@ -412,6 +395,7 @@ func (a *PetApiService) GetPetById(ctx context.Context, petId int64) (Pet, *http
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, err
|
||||
@@ -441,7 +425,6 @@ func (a *PetApiService) GetPetById(ctx context.Context, petId int64) (Pet, *http
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode == 200 {
|
||||
var v Pet
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
@@ -452,7 +435,6 @@ func (a *PetApiService) GetPetById(ctx context.Context, petId int64) (Pet, *http
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
@@ -463,8 +445,6 @@ func (a *PetApiService) GetPetById(ctx context.Context, petId int64) (Pet, *http
|
||||
PetApiService Update an existing pet
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param pet Pet object that needs to be added to the store
|
||||
|
||||
|
||||
*/
|
||||
func (a *PetApiService) UpdatePet(ctx context.Context, pet Pet) (*http.Response, error) {
|
||||
var (
|
||||
@@ -472,7 +452,6 @@ func (a *PetApiService) UpdatePet(ctx context.Context, pet Pet) (*http.Response,
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@@ -517,13 +496,11 @@ func (a *PetApiService) UpdatePet(ctx context.Context, pet Pet) (*http.Response,
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
return localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
@@ -535,15 +512,13 @@ 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 "" (optional.String) - Updated name of the pet
|
||||
* @param "" (optional.String) - Updated status of the pet
|
||||
|
||||
|
||||
* @param "Name" (optional.String) - Updated name of the pet
|
||||
* @param "Status" (optional.String) - Updated status of the pet
|
||||
*/
|
||||
|
||||
type UpdatePetWithFormOpts struct {
|
||||
optional.String
|
||||
optional.String
|
||||
type UpdatePetWithFormOpts struct {
|
||||
Name optional.String
|
||||
Status optional.String
|
||||
}
|
||||
|
||||
func (a *PetApiService) UpdatePetWithForm(ctx context.Context, petId int64, localVarOptionals *UpdatePetWithFormOpts) (*http.Response, error) {
|
||||
@@ -552,7 +527,6 @@ func (a *PetApiService) UpdatePetWithForm(ctx context.Context, petId int64, loca
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@@ -580,11 +554,11 @@ func (a *PetApiService) UpdatePetWithForm(ctx context.Context, petId int64, loca
|
||||
if localVarHttpHeaderAccept != "" {
|
||||
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
if localVarOptionals != nil && localVarOptionals..IsSet() {
|
||||
localVarFormParams.Add("name", parameterToString(localVarOptionals..Value(), ""))
|
||||
if localVarOptionals != nil && localVarOptionals.Name.IsSet() {
|
||||
localVarFormParams.Add("name", parameterToString(localVarOptionals.Name.Value(), ""))
|
||||
}
|
||||
if localVarOptionals != nil && localVarOptionals..IsSet() {
|
||||
localVarFormParams.Add("status", parameterToString(localVarOptionals..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, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
@@ -602,13 +576,11 @@ func (a *PetApiService) UpdatePetWithForm(ctx context.Context, petId int64, loca
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
return localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
@@ -620,24 +592,23 @@ 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 "" (optional.String) - Additional data to pass to server
|
||||
* @param "" (optional.*os.File) - file to upload
|
||||
|
||||
@return ModelApiResponse
|
||||
* @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 {
|
||||
optional.String
|
||||
optional.*os.File
|
||||
type UploadFileOpts struct {
|
||||
AdditionalMetadata optional.String
|
||||
File optional.Interface
|
||||
}
|
||||
|
||||
func (a *PetApiService) UploadFile(ctx context.Context, petId int64, localVarOptionals *UploadFileOpts) (ModelApiResponse, *http.Response, error) {
|
||||
func (a *PetApiService) UploadFile(ctx context.Context, petId int64, localVarOptionals *UploadFileOpts) (ApiResponse, *http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Post")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
localVarReturnValue ModelApiResponse
|
||||
localVarReturnValue ApiResponse
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@@ -665,13 +636,13 @@ func (a *PetApiService) UploadFile(ctx context.Context, petId int64, localVarOpt
|
||||
if localVarHttpHeaderAccept != "" {
|
||||
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
if localVarOptionals != nil && localVarOptionals..IsSet() {
|
||||
localVarFormParams.Add("additionalMetadata", parameterToString(localVarOptionals..Value(), ""))
|
||||
if localVarOptionals != nil && localVarOptionals.AdditionalMetadata.IsSet() {
|
||||
localVarFormParams.Add("additionalMetadata", parameterToString(localVarOptionals.AdditionalMetadata.Value(), ""))
|
||||
}
|
||||
var localVarFile *os.File
|
||||
if localVarOptionals != nil && localVarOptionals..IsSet() {
|
||||
if localVarOptionals != nil && localVarOptionals.File.IsSet() {
|
||||
localVarFileOk := false
|
||||
localVarFile, localVarFileOk = localVarOptionals..Value().(*os.File)
|
||||
localVarFile, localVarFileOk = localVarOptionals.File.Value().(*os.File)
|
||||
if !localVarFileOk {
|
||||
return localVarReturnValue, nil, reportError("file should be *os.File")
|
||||
}
|
||||
@@ -711,9 +682,8 @@ func (a *PetApiService) UploadFile(ctx context.Context, petId int64, localVarOpt
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode == 200 {
|
||||
var v ModelApiResponse
|
||||
var v ApiResponse
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
@@ -722,7 +692,6 @@ func (a *PetApiService) UploadFile(ctx context.Context, petId int64, localVarOpt
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
|
||||
@@ -31,8 +31,6 @@ 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 (
|
||||
@@ -40,7 +38,6 @@ func (a *StoreApiService) DeleteOrder(ctx context.Context, orderId string) (*htt
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@@ -84,13 +81,11 @@ func (a *StoreApiService) DeleteOrder(ctx context.Context, orderId string) (*htt
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
return localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
@@ -101,7 +96,6 @@ func (a *StoreApiService) DeleteOrder(ctx context.Context, orderId string) (*htt
|
||||
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) {
|
||||
@@ -150,6 +144,7 @@ func (a *StoreApiService) GetInventory(ctx context.Context) (map[string]int32, *
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, err
|
||||
@@ -179,7 +174,6 @@ func (a *StoreApiService) GetInventory(ctx context.Context) (map[string]int32, *
|
||||
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"));
|
||||
@@ -190,7 +184,6 @@ func (a *StoreApiService) GetInventory(ctx context.Context) (map[string]int32, *
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
@@ -202,7 +195,6 @@ 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) {
|
||||
@@ -274,7 +266,6 @@ func (a *StoreApiService) GetOrderById(ctx context.Context, orderId int64) (Orde
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode == 200 {
|
||||
var v Order
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
@@ -285,7 +276,6 @@ func (a *StoreApiService) GetOrderById(ctx context.Context, orderId int64) (Orde
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
@@ -296,7 +286,6 @@ func (a *StoreApiService) GetOrderById(ctx context.Context, orderId int64) (Orde
|
||||
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 order order placed for purchasing the pet
|
||||
|
||||
@return Order
|
||||
*/
|
||||
func (a *StoreApiService) PlaceOrder(ctx context.Context, order Order) (Order, *http.Response, error) {
|
||||
@@ -363,7 +352,6 @@ func (a *StoreApiService) PlaceOrder(ctx context.Context, order Order) (Order, *
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode == 200 {
|
||||
var v Order
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
@@ -374,7 +362,6 @@ func (a *StoreApiService) PlaceOrder(ctx context.Context, order Order) (Order, *
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
|
||||
@@ -31,8 +31,6 @@ 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 user Created user object
|
||||
|
||||
|
||||
*/
|
||||
func (a *UserApiService) CreateUser(ctx context.Context, user User) (*http.Response, error) {
|
||||
var (
|
||||
@@ -40,7 +38,6 @@ func (a *UserApiService) CreateUser(ctx context.Context, user User) (*http.Respo
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@@ -85,13 +82,11 @@ func (a *UserApiService) CreateUser(ctx context.Context, user User) (*http.Respo
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
return localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
@@ -102,8 +97,6 @@ func (a *UserApiService) CreateUser(ctx context.Context, user User) (*http.Respo
|
||||
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 user List of user object
|
||||
|
||||
|
||||
*/
|
||||
func (a *UserApiService) CreateUsersWithArrayInput(ctx context.Context, user []User) (*http.Response, error) {
|
||||
var (
|
||||
@@ -111,7 +104,6 @@ func (a *UserApiService) CreateUsersWithArrayInput(ctx context.Context, user []U
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@@ -156,13 +148,11 @@ func (a *UserApiService) CreateUsersWithArrayInput(ctx context.Context, user []U
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
return localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
@@ -173,8 +163,6 @@ func (a *UserApiService) CreateUsersWithArrayInput(ctx context.Context, user []U
|
||||
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 user List of user object
|
||||
|
||||
|
||||
*/
|
||||
func (a *UserApiService) CreateUsersWithListInput(ctx context.Context, user []User) (*http.Response, error) {
|
||||
var (
|
||||
@@ -182,7 +170,6 @@ func (a *UserApiService) CreateUsersWithListInput(ctx context.Context, user []Us
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@@ -227,13 +214,11 @@ func (a *UserApiService) CreateUsersWithListInput(ctx context.Context, user []Us
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
return localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
@@ -245,8 +230,6 @@ 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 (
|
||||
@@ -254,7 +237,6 @@ func (a *UserApiService) DeleteUser(ctx context.Context, username string) (*http
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@@ -298,13 +280,11 @@ func (a *UserApiService) DeleteUser(ctx context.Context, username string) (*http
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
return localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
@@ -315,7 +295,6 @@ func (a *UserApiService) DeleteUser(ctx context.Context, username string) (*http
|
||||
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) {
|
||||
@@ -381,7 +360,6 @@ func (a *UserApiService) GetUserByName(ctx context.Context, username string) (Us
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode == 200 {
|
||||
var v User
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
@@ -392,7 +370,6 @@ func (a *UserApiService) GetUserByName(ctx context.Context, username string) (Us
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
@@ -404,7 +381,6 @@ 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) {
|
||||
@@ -423,8 +399,8 @@ func (a *UserApiService) LoginUser(ctx context.Context, username string, passwor
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
localVarQueryParams.Add("username", parameterToString(username, "csv"))
|
||||
localVarQueryParams.Add("password", parameterToString(password, "csv"))
|
||||
localVarQueryParams.Add("username", parameterToString(username, ""))
|
||||
localVarQueryParams.Add("password", parameterToString(password, ""))
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{}
|
||||
|
||||
@@ -471,7 +447,6 @@ func (a *UserApiService) LoginUser(ctx context.Context, username string, passwor
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode == 200 {
|
||||
var v string
|
||||
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
||||
@@ -482,7 +457,6 @@ func (a *UserApiService) LoginUser(ctx context.Context, username string, passwor
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
@@ -492,8 +466,6 @@ func (a *UserApiService) LoginUser(ctx context.Context, username string, passwor
|
||||
/*
|
||||
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 (
|
||||
@@ -501,7 +473,6 @@ func (a *UserApiService) LogoutUser(ctx context.Context) (*http.Response, error)
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@@ -544,13 +515,11 @@ func (a *UserApiService) LogoutUser(ctx context.Context) (*http.Response, error)
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
return localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
@@ -563,8 +532,6 @@ 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 user Updated user object
|
||||
|
||||
|
||||
*/
|
||||
func (a *UserApiService) UpdateUser(ctx context.Context, username string, user User) (*http.Response, error) {
|
||||
var (
|
||||
@@ -572,7 +539,6 @@ func (a *UserApiService) UpdateUser(ctx context.Context, username string, user U
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
@@ -618,13 +584,11 @@ func (a *UserApiService) UpdateUser(ctx context.Context, username string, user U
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericSwaggerError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
|
||||
return localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
|
||||
12
samples/client/petstore/go/go-petstore/docs/ApiResponse.md
Normal file
12
samples/client/petstore/go/go-petstore/docs/ApiResponse.md
Normal file
@@ -0,0 +1,12 @@
|
||||
# ApiResponse
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**Code** | **int32** | | [optional] [default to null]
|
||||
**Type** | **string** | | [optional] [default to null]
|
||||
**Message** | **string** | | [optional] [default to null]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ Method | HTTP request | Description
|
||||
|
||||
|
||||
# **FakeOuterBooleanSerialize**
|
||||
> OuterBoolean FakeOuterBooleanSerialize(ctx, optional)
|
||||
> bool FakeOuterBooleanSerialize(ctx, optional)
|
||||
|
||||
|
||||
Test serialization of outer boolean types
|
||||
@@ -38,7 +38,7 @@ Name | Type | Description | Notes
|
||||
|
||||
### Return type
|
||||
|
||||
[**OuterBoolean**](OuterBoolean.md)
|
||||
**bool**
|
||||
|
||||
### Authorization
|
||||
|
||||
@@ -87,7 +87,7 @@ No authorization required
|
||||
[[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**
|
||||
> OuterNumber FakeOuterNumberSerialize(ctx, optional)
|
||||
> float32 FakeOuterNumberSerialize(ctx, optional)
|
||||
|
||||
|
||||
Test serialization of outer number types
|
||||
@@ -108,7 +108,7 @@ Name | Type | Description | Notes
|
||||
|
||||
### Return type
|
||||
|
||||
[**OuterNumber**](OuterNumber.md)
|
||||
**float32**
|
||||
|
||||
### Authorization
|
||||
|
||||
@@ -122,7 +122,7 @@ No authorization required
|
||||
[[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**
|
||||
> OuterString FakeOuterStringSerialize(ctx, optional)
|
||||
> string FakeOuterStringSerialize(ctx, optional)
|
||||
|
||||
|
||||
Test serialization of outer string types
|
||||
@@ -143,7 +143,7 @@ Name | Type | Description | Notes
|
||||
|
||||
### Return type
|
||||
|
||||
[**OuterString**](OuterString.md)
|
||||
**string**
|
||||
|
||||
### Authorization
|
||||
|
||||
@@ -212,7 +212,7 @@ No authorization required
|
||||
[[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)
|
||||
> TestEndpointParameters(ctx, number, double, patternWithoutDelimiter, byte_, optional)
|
||||
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
|
||||
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
@@ -225,7 +225,7 @@ Name | Type | Description | Notes
|
||||
**number** | **float32**| None |
|
||||
**double** | **float64**| None |
|
||||
**patternWithoutDelimiter** | **string**| None |
|
||||
**byte** | **string**| None |
|
||||
**byte_** | **string**| None |
|
||||
**optional** | ***TestEndpointParametersOpts** | optional parameters | nil if no parameters
|
||||
|
||||
### Optional Parameters
|
||||
@@ -238,10 +238,10 @@ Name | Type | Description | Notes
|
||||
|
||||
|
||||
**integer** | **optional.Int32**| None |
|
||||
**int32** | **optional.Int32**| None |
|
||||
**int64** | **optional.Int64**| None |
|
||||
**int32_** | **optional.Int32**| None |
|
||||
**int64_** | **optional.Int64**| None |
|
||||
**float** | **optional.Float32**| None |
|
||||
**string** | **optional.String**| None |
|
||||
**string_** | **optional.String**| None |
|
||||
**binary** | **optional.Interface of *os.File****optional.*os.File**| None |
|
||||
**date** | **optional.String**| None |
|
||||
**dateTime** | **optional.Time**| None |
|
||||
|
||||
@@ -4,13 +4,13 @@
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**Integer** | **int32** | | [optional] [default to null]
|
||||
**Int32_** | **int32** | | [optional] [default to null]
|
||||
**Int64_** | **int64** | | [optional] [default to null]
|
||||
**Int32** | **int32** | | [optional] [default to null]
|
||||
**Int64** | **int64** | | [optional] [default to null]
|
||||
**Number** | **float32** | | [default to null]
|
||||
**Float** | **float32** | | [optional] [default to null]
|
||||
**Double** | **float64** | | [optional] [default to null]
|
||||
**String_** | **string** | | [optional] [default to null]
|
||||
**Byte_** | **string** | | [default to null]
|
||||
**String** | **string** | | [optional] [default to null]
|
||||
**Byte** | **string** | | [default to null]
|
||||
**Binary** | [****os.File**](*os.File.md) | | [optional] [default to null]
|
||||
**Date** | **string** | | [default to null]
|
||||
**DateTime** | [**time.Time**](time.Time.md) | | [optional] [default to null]
|
||||
|
||||
@@ -5,7 +5,7 @@ Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**Uuid** | **string** | | [optional] [default to null]
|
||||
**DateTime** | [**time.Time**](time.Time.md) | | [optional] [default to null]
|
||||
**Map_** | [**map[string]Animal**](Animal.md) | | [optional] [default to null]
|
||||
**Map** | [**map[string]Animal**](Animal.md) | | [optional] [default to null]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**MyNumber** | [***OuterNumber**](OuterNumber.md) | | [optional] [default to null]
|
||||
**MyString** | [***OuterString**](OuterString.md) | | [optional] [default to null]
|
||||
**MyBoolean** | [***OuterBoolean**](OuterBoolean.md) | | [optional] [default to null]
|
||||
**MyNumber** | **float32** | | [optional] [default to null]
|
||||
**MyString** | **string** | | [optional] [default to null]
|
||||
**MyBoolean** | **bool** | | [optional] [default to null]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@@ -222,7 +222,7 @@ Name | Type | Description | Notes
|
||||
[[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**
|
||||
> ModelApiResponse UploadFile(ctx, petId, optional)
|
||||
> ApiResponse UploadFile(ctx, petId, optional)
|
||||
uploads an image
|
||||
|
||||
### Required Parameters
|
||||
@@ -244,7 +244,7 @@ Name | Type | Description | Notes
|
||||
|
||||
### Return type
|
||||
|
||||
[**ModelApiResponse**](ApiResponse.md)
|
||||
[**ApiResponse**](ApiResponse.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
|
||||
10
samples/client/petstore/go/go-petstore/docs/Return.md
Normal file
10
samples/client/petstore/go/go-petstore/docs/Return.md
Normal file
@@ -0,0 +1,10 @@
|
||||
# Return
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**Return** | **int32** | | [optional] [default to null]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
|
||||
package petstore
|
||||
|
||||
type ModelApiResponse struct {
|
||||
type ApiResponse struct {
|
||||
Code int32 `json:"code,omitempty"`
|
||||
Type_ string `json:"type,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
Message string `json:"message,omitempty"`
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
*/
|
||||
|
||||
package petstore
|
||||
|
||||
type EnumClass string
|
||||
|
||||
// List of EnumClass
|
||||
@@ -17,4 +16,4 @@ const (
|
||||
ABC EnumClass = "_abc"
|
||||
EFG EnumClass = "-efg"
|
||||
XYZ EnumClass = "(xyz)"
|
||||
)
|
||||
)
|
||||
@@ -9,24 +9,20 @@
|
||||
*/
|
||||
|
||||
package petstore
|
||||
|
||||
import (
|
||||
import (
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
type FormatTest struct {
|
||||
Integer int32 `json:"integer,omitempty"`
|
||||
Int32_ int32 `json:"int32,omitempty"`
|
||||
Int64_ int64 `json:"int64,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"`
|
||||
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"`
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
*/
|
||||
|
||||
package petstore
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
@@ -17,5 +16,5 @@ import (
|
||||
type MixedPropertiesAndAdditionalPropertiesClass struct {
|
||||
Uuid string `json:"uuid,omitempty"`
|
||||
DateTime time.Time `json:"dateTime,omitempty"`
|
||||
Map_ map[string]Animal `json:"map,omitempty"`
|
||||
Map map[string]Animal `json:"map,omitempty"`
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
*/
|
||||
|
||||
package petstore
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
package petstore
|
||||
|
||||
type OuterComposite struct {
|
||||
MyNumber *OuterNumber `json:"my_number,omitempty"`
|
||||
MyString *OuterString `json:"my_string,omitempty"`
|
||||
MyBoolean *OuterBoolean `json:"my_boolean,omitempty"`
|
||||
MyNumber float32 `json:"my_number,omitempty"`
|
||||
MyString string `json:"my_string,omitempty"`
|
||||
MyBoolean bool `json:"my_boolean,omitempty"`
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
*/
|
||||
|
||||
package petstore
|
||||
|
||||
type OuterEnum string
|
||||
|
||||
// List of OuterEnum
|
||||
@@ -17,4 +16,4 @@ const (
|
||||
PLACED OuterEnum = "placed"
|
||||
APPROVED OuterEnum = "approved"
|
||||
DELIVERED OuterEnum = "delivered"
|
||||
)
|
||||
)
|
||||
@@ -11,6 +11,6 @@
|
||||
package petstore
|
||||
|
||||
// Model for testing reserved words
|
||||
type ModelReturn struct {
|
||||
Return_ int32 `json:"return,omitempty"`
|
||||
type Return struct {
|
||||
Return int32 `json:"return,omitempty"`
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
sw "./go-petstore"
|
||||
"golang.org/x/net/context"
|
||||
|
||||
"github.com/antihax/optional"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
@@ -58,7 +59,12 @@ func TestGetPetById(t *testing.T) {
|
||||
func TestGetPetByIdWithInvalidID(t *testing.T) {
|
||||
resp, r, err := client.PetApi.GetPetById(context.Background(), 999999999)
|
||||
if r != nil && r.StatusCode == 404 {
|
||||
return // This is a pass condition. API will return with a 404 error.
|
||||
assertedError, ok := err.(sw.GenericSwaggerError)
|
||||
a := assert.New(t)
|
||||
a.True(ok)
|
||||
a.Contains(string(assertedError.Body()), "type")
|
||||
|
||||
a.Contains(assertedError.Error(), "Not Found")
|
||||
} else if err != nil {
|
||||
t.Errorf("Error while getting pet by invalid id")
|
||||
t.Log(err)
|
||||
@@ -69,8 +75,10 @@ func TestGetPetByIdWithInvalidID(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdatePetWithForm(t *testing.T) {
|
||||
r, err := client.PetApi.UpdatePetWithForm(context.Background(), 12830, map[string]interface{}{"name": "golang", "status": "available"})
|
||||
|
||||
r, err := client.PetApi.UpdatePetWithForm(context.Background(), 12830, &sw.UpdatePetWithFormOpts{
|
||||
Name: optional.NewString("golang"),
|
||||
Status: optional.NewString("available"),
|
||||
})
|
||||
if err != nil {
|
||||
t.Errorf("Error while updating pet by id")
|
||||
t.Log(err)
|
||||
@@ -137,7 +145,10 @@ func TestFindPetsByStatus(t *testing.T) {
|
||||
func TestUploadFile(t *testing.T) {
|
||||
file, _ := os.Open("../python/testfiles/foo.png")
|
||||
|
||||
_, r, err := client.PetApi.UploadFile(context.Background(), 12830, map[string]interface{}{"name": "golang", "file": file})
|
||||
_, r, err := client.PetApi.UploadFile(context.Background(), 12830, &sw.UploadFileOpts{
|
||||
AdditionalMetadata: optional.NewString("golang"),
|
||||
File: optional.NewInterface(file),
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
t.Errorf("Error while uploading file")
|
||||
|
||||
@@ -111,6 +111,7 @@ Class | Method | HTTP request | Description
|
||||
|
||||
- [Petstore::AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md)
|
||||
- [Petstore::Animal](docs/Animal.md)
|
||||
- [Petstore::AnimalFarm](docs/AnimalFarm.md)
|
||||
- [Petstore::ApiResponse](docs/ApiResponse.md)
|
||||
- [Petstore::ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md)
|
||||
- [Petstore::ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md)
|
||||
|
||||
@@ -19,6 +19,7 @@ require 'petstore/configuration'
|
||||
# Models
|
||||
require 'petstore/models/additional_properties_class'
|
||||
require 'petstore/models/animal'
|
||||
require 'petstore/models/animal_farm'
|
||||
require 'petstore/models/api_response'
|
||||
require 'petstore/models/array_of_array_of_number_only'
|
||||
require 'petstore/models/array_of_number_only'
|
||||
|
||||
Reference in New Issue
Block a user