[python-experimental] generate model if type != object if enums/validations exist (#2757)

* Python-experimental adds model_utils module, refactors python api class

* Fixes python-experimental so the sample sare generated in the petstore_api folder

* FIxes python samples tests

* Updates python and python-experimental tests

* Fixes python-experimental tests

* Adds newlines back to python templates + samples

* Reverts files with newline tweaks back to master branch versions

* Fixes indentation errors in python-experimental api_client

* Removes unused files

* Python files now generated in correct folders

* Adds logging when the user tries to set generateAliasAsModel in python-experimental

* Fixes typo
This commit is contained in:
Justin Black 2019-09-24 03:44:28 -07:00 committed by William Cheng
parent 002da8d9f9
commit 252c3e58be
106 changed files with 9581 additions and 7758 deletions

View File

@ -27,6 +27,6 @@ fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -t modules/openapi-generator/src/main/resources/python -i modules/openapi-generator/src/test/resources/2_0/python-client-experimental/petstore-with-fake-endpoints-models-for-testing.yaml -g python-experimental -o samples/client/petstore/python-experimental -DpackageName=petstore_api $@"
ags="generate -t modules/openapi-generator/src/main/resources/python -i modules/openapi-generator/src/test/resources/2_0/python-client-experimental/petstore-with-fake-endpoints-models-for-testing.yaml -g python-experimental -o samples/client/petstore/python-experimental --additional-properties packageName=petstore_api $@"
java $JAVA_OPTS -jar $executable $ags

View File

@ -2493,6 +2493,76 @@ public class DefaultCodegen implements CodegenConfig {
return responses.get(code);
}
/**
* Set op's returnBaseType, returnType, examples etc.
*
* @param operation endpoint Operation
* @param schemas a map of the schemas in the openapi spec
* @param op endpoint CodegenOperation
* @param methodResponse the default ApiResponse for the endpoint
*/
protected void handleMethodResponse(Operation operation,
Map<String, Schema> schemas,
CodegenOperation op,
ApiResponse methodResponse) {
Schema responseSchema = ModelUtils.unaliasSchema(this.openAPI, ModelUtils.getSchemaFromResponse(methodResponse));
if (responseSchema != null) {
CodegenProperty cm = fromProperty("response", responseSchema);
if (ModelUtils.isArraySchema(responseSchema)) {
ArraySchema as = (ArraySchema) responseSchema;
CodegenProperty innerProperty = fromProperty("response", getSchemaItems(as));
op.returnBaseType = innerProperty.baseType;
} else if (ModelUtils.isMapSchema(responseSchema)) {
CodegenProperty innerProperty = fromProperty("response", ModelUtils.getAdditionalProperties(responseSchema));
op.returnBaseType = innerProperty.baseType;
} else {
if (cm.complexType != null) {
op.returnBaseType = cm.complexType;
} else {
op.returnBaseType = cm.baseType;
}
}
// generate examples
String exampleStatusCode = "200";
for (String key : operation.getResponses().keySet()) {
if (operation.getResponses().get(key) == methodResponse && !key.equals("default")) {
exampleStatusCode = key;
}
}
op.examples = new ExampleGenerator(schemas, this.openAPI).generateFromResponseSchema(exampleStatusCode, responseSchema, getProducesInfo(this.openAPI, operation));
op.defaultResponse = toDefaultValue(responseSchema);
op.returnType = cm.dataType;
op.hasReference = schemas.containsKey(op.returnBaseType);
// lookup discriminator
Schema schema = schemas.get(op.returnBaseType);
if (schema != null) {
CodegenModel cmod = fromModel(op.returnBaseType, schema);
op.discriminator = cmod.discriminator;
}
if (cm.isContainer) {
op.returnContainer = cm.containerType;
if ("map".equals(cm.containerType)) {
op.isMapContainer = true;
} else if ("list".equalsIgnoreCase(cm.containerType)) {
op.isListContainer = true;
} else if ("array".equalsIgnoreCase(cm.containerType)) {
op.isListContainer = true;
}
} else {
op.returnSimpleType = true;
}
if (languageSpecificPrimitives().contains(op.returnBaseType) || op.returnBaseType == null) {
op.returnTypeIsPrimitive = true;
}
}
addHeaders(methodResponse, op.responseHeaders);
}
/**
* Convert OAS Operation object to Codegen Operation object
*
@ -2585,62 +2655,7 @@ public class DefaultCodegen implements CodegenConfig {
op.responses.get(op.responses.size() - 1).hasMore = false;
if (methodResponse != null) {
Schema responseSchema = ModelUtils.unaliasSchema(this.openAPI, ModelUtils.getSchemaFromResponse(methodResponse));
if (responseSchema != null) {
CodegenProperty cm = fromProperty("response", responseSchema);
if (ModelUtils.isArraySchema(responseSchema)) {
ArraySchema as = (ArraySchema) responseSchema;
CodegenProperty innerProperty = fromProperty("response", getSchemaItems(as));
op.returnBaseType = innerProperty.baseType;
} else if (ModelUtils.isMapSchema(responseSchema)) {
CodegenProperty innerProperty = fromProperty("response", ModelUtils.getAdditionalProperties(responseSchema));
op.returnBaseType = innerProperty.baseType;
} else {
if (cm.complexType != null) {
op.returnBaseType = cm.complexType;
} else {
op.returnBaseType = cm.baseType;
}
}
// generate examples
String exampleStatusCode = "200";
for (String key : operation.getResponses().keySet()) {
if (operation.getResponses().get(key) == methodResponse && !key.equals("default")) {
exampleStatusCode = key;
}
}
op.examples = new ExampleGenerator(schemas, this.openAPI).generateFromResponseSchema(exampleStatusCode, responseSchema, getProducesInfo(this.openAPI, operation));
op.defaultResponse = toDefaultValue(responseSchema);
op.returnType = cm.dataType;
op.hasReference = schemas.containsKey(op.returnBaseType);
// lookup discriminator
Schema schema = schemas.get(op.returnBaseType);
if (schema != null) {
CodegenModel cmod = fromModel(op.returnBaseType, schema);
op.discriminator = cmod.discriminator;
}
if (cm.isContainer) {
op.returnContainer = cm.containerType;
if ("map".equals(cm.containerType)) {
op.isMapContainer = true;
} else if ("list".equalsIgnoreCase(cm.containerType)) {
op.isListContainer = true;
} else if ("array".equalsIgnoreCase(cm.containerType)) {
op.isListContainer = true;
}
} else {
op.returnSimpleType = true;
}
if (languageSpecificPrimitives().contains(op.returnBaseType) || op.returnBaseType == null) {
op.returnTypeIsPrimitive = true;
}
}
addHeaders(methodResponse, op.responseHeaders);
handleMethodResponse(operation, schemas, op, methodResponse);
}
}
@ -3511,7 +3526,7 @@ public class DefaultCodegen implements CodegenConfig {
* @param response API response
* @param properties list of codegen property
*/
private void addHeaders(ApiResponse response, List<CodegenProperty> properties) {
protected void addHeaders(ApiResponse response, List<CodegenProperty> properties) {
if (response.getHeaders() != null) {
for (Map.Entry<String, Header> headerEntry : response.getHeaders().entrySet()) {
String description = headerEntry.getValue().getDescription();
@ -4316,7 +4331,7 @@ public class DefaultCodegen implements CodegenConfig {
}
}
private void updateEnumVarsWithExtensions(List<Map<String, Object>> enumVars, Map<String, Object> vendorExtensions) {
protected void updateEnumVarsWithExtensions(List<Map<String, Object>> enumVars, Map<String, Object> vendorExtensions) {
if (vendorExtensions != null) {
updateEnumVarsWithExtensions(enumVars, vendorExtensions, "x-enum-varnames", "name");
updateEnumVarsWithExtensions(enumVars, vendorExtensions, "x-enum-descriptions", "enumDescription");

View File

@ -490,10 +490,9 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
// TODO revise below as we've already performed unaliasing so that the isAlias check may be removed
Map<String, Object> modelTemplate = (Map<String, Object>) ((List<Object>) models.get("models")).get(0);
// Special handling of aliases only applies to Java
if (modelTemplate != null && modelTemplate.containsKey("model")) {
CodegenModel m = (CodegenModel) modelTemplate.get("model");
if (m.isAlias) {
if (m.isAlias && !ModelUtils.isGenerateAliasAsModel()) {
continue; // Don't create user-defined classes for aliases
}
}

View File

@ -16,31 +16,50 @@
package org.openapitools.codegen.languages;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import io.swagger.v3.oas.models.Operation;
import io.swagger.v3.oas.models.examples.Example;
import io.swagger.v3.oas.models.media.*;
import io.swagger.v3.oas.models.media.ArraySchema;
import io.swagger.v3.oas.models.media.MediaType;
import io.swagger.v3.oas.models.media.Schema;
import io.swagger.v3.oas.models.parameters.Parameter;
import io.swagger.v3.oas.models.parameters.RequestBody;
import io.swagger.v3.oas.models.responses.ApiResponse;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang3.StringUtils;
import org.openapitools.codegen.*;
import org.openapitools.codegen.examples.ExampleGenerator;
import org.openapitools.codegen.utils.ModelUtils;
import org.openapitools.codegen.meta.GeneratorMetadata;
import org.openapitools.codegen.meta.Stability;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import io.swagger.v3.oas.models.media.Schema;
import org.openapitools.codegen.*;
import org.openapitools.codegen.utils.ModelUtils;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.io.File;
import java.util.*;
import java.util.regex.Pattern;
import static org.openapitools.codegen.utils.StringUtils.camelize;
import static org.openapitools.codegen.utils.StringUtils.underscore;
public class PythonClientExperimentalCodegen extends PythonClientCodegen {
private static final Logger LOGGER = LoggerFactory.getLogger(PythonClientExperimentalCodegen.class);
public PythonClientExperimentalCodegen() {
super();
supportingFiles.add(new SupportingFile("python-experimental/api_client.mustache", packagePath(), "api_client.py"));
apiDocTemplateFiles.put("python-experimental/api_doc.mustache", ".md");
apiTemplateFiles.remove("api.mustache");
apiTemplateFiles.put("python-experimental/api.mustache", ".py");
apiDocTemplateFiles.remove("api_doc.mustache");
apiDocTemplateFiles.put("python-experimental/api_doc.mustache", ".md");
modelDocTemplateFiles.remove("model_doc.mustache");
modelDocTemplateFiles.put("python-experimental/model_doc.mustache", ".md");
modelTemplateFiles.remove("model.mustache");
modelTemplateFiles.put("python-experimental/model.mustache", ".py");
generatorMetadata = GeneratorMetadata.newBuilder(generatorMetadata)
@ -48,6 +67,23 @@ public class PythonClientExperimentalCodegen extends PythonClientCodegen {
.build();
}
@Override
public void processOpts() {
super.processOpts();
supportingFiles.remove(new SupportingFile("api_client.mustache", packagePath(), "api_client.py"));
supportingFiles.add(new SupportingFile("python-experimental/api_client.mustache", packagePath(), "api_client.py"));
supportingFiles.add(new SupportingFile("python-experimental/model_utils.mustache", packagePath(), "model_utils.py"));
// default this to true so the python ModelSimple models will be generated
ModelUtils.setGenerateAliasAsModel(true);
if (additionalProperties.containsKey(CodegenConstants.GENERATE_ALIAS_AS_MODEL)) {
LOGGER.info(CodegenConstants.GENERATE_ALIAS_AS_MODEL + " is hard coded to true in this generator. Alias models will only be generated if they contain validations or enums");
}
}
/**
* Configures a friendly name for the generator. This will be used by the
* generator to select the library with the -g flag.
@ -162,4 +198,397 @@ public class PythonClientExperimentalCodegen extends PythonClientCodegen {
}
}
@Override
public void postProcessModelProperty(CodegenModel model, CodegenProperty property) {
// add regex information to property
postProcessPattern(property.pattern, property.vendorExtensions);
}
// override with any special post-processing for all models
@SuppressWarnings({"static-method", "unchecked"})
public Map<String, Object> postProcessAllModels(Map<String, Object> objs) {
// loop through all models and delete ones where type!=object and the model has no validations and enums
// we will remove them because they are not needed
Map<String, Schema> modelSchemasToRemove = new HashMap<String, Schema>();
for (Map.Entry<String, Object> entry : objs.entrySet()) {
Map<String, Object> inner = (Map<String, Object>) entry.getValue();
List<Map<String, Object>> models = (List<Map<String, Object>>) inner.get("models");
for (Map<String, Object> mo : models) {
CodegenModel cm = (CodegenModel) mo.get("model");
Schema modelSchema = ModelUtils.getSchema(this.openAPI, cm.name);
CodegenProperty modelProperty = fromProperty("value", modelSchema);
if (cm.isEnum || cm.isAlias) {
if (!modelProperty.isEnum && !modelProperty.hasValidation) {
// remove these models because they are aliases and do not have any enums or validations
modelSchemasToRemove.put(cm.name, modelSchema);
}
} else if (cm.isArrayModel && !modelProperty.isEnum && !modelProperty.hasValidation) {
// remove any ArrayModels which lack validation and enums
modelSchemasToRemove.put(cm.name, modelSchema);
}
}
}
// Remove modelSchemasToRemove models from objs
for (String modelName : modelSchemasToRemove.keySet()) {
objs.remove(modelName);
}
return objs;
}
/**
* Convert OAS Property object to Codegen Property object
*
* @param name name of the property
* @param p OAS property object
* @return Codegen Property object
*/
@Override
public CodegenProperty fromProperty(String name, Schema p) {
// we have a custom version of this function to always set allowableValues.enumVars on all enum variables
CodegenProperty result = super.fromProperty(name, p);
if (result.isEnum) {
updateCodegenPropertyEnum(result);
}
return result;
}
/**
* Update codegen property's enum by adding "enumVars" (with name and value)
*
* @param var list of CodegenProperty
*/
@Override
public void updateCodegenPropertyEnum(CodegenProperty var) {
// we have a custom version of this method to omit overwriting the defaultValue
Map<String, Object> allowableValues = var.allowableValues;
// handle array
if (var.mostInnerItems != null) {
allowableValues = var.mostInnerItems.allowableValues;
}
if (allowableValues == null) {
return;
}
List<Object> values = (List<Object>) allowableValues.get("values");
if (values == null) {
return;
}
String varDataType = var.mostInnerItems != null ? var.mostInnerItems.dataType : var.dataType;
Optional<Schema> referencedSchema = ModelUtils.getSchemas(openAPI).entrySet().stream()
.filter(entry -> Objects.equals(varDataType, toModelName(entry.getKey())))
.map(Map.Entry::getValue)
.findFirst();
String dataType = (referencedSchema.isPresent()) ? getTypeDeclaration(referencedSchema.get()) : varDataType;
// put "enumVars" map into `allowableValues", including `name` and `value`
List<Map<String, Object>> enumVars = new ArrayList<>();
String commonPrefix = findCommonPrefixOfVars(values);
int truncateIdx = commonPrefix.length();
for (Object value : values) {
Map<String, Object> enumVar = new HashMap<>();
String enumName;
if (truncateIdx == 0) {
enumName = value.toString();
} else {
enumName = value.toString().substring(truncateIdx);
if ("".equals(enumName)) {
enumName = value.toString();
}
}
enumVar.put("name", toEnumVarName(enumName, dataType));
enumVar.put("value", toEnumValue(value.toString(), dataType));
enumVar.put("isString", isDataTypeString(dataType));
enumVars.add(enumVar);
}
// if "x-enum-varnames" or "x-enum-descriptions" defined, update varnames
Map<String, Object> extensions = var.mostInnerItems != null ? var.mostInnerItems.getVendorExtensions() : var.getVendorExtensions();
if (referencedSchema.isPresent()) {
extensions = referencedSchema.get().getExtensions();
}
updateEnumVarsWithExtensions(enumVars, extensions);
allowableValues.put("enumVars", enumVars);
// overwriting defaultValue omitted from here
}
@Override
public CodegenParameter fromRequestBody(RequestBody body, Set<String> imports, String bodyParameterName) {
CodegenParameter result = super.fromRequestBody(body, imports, bodyParameterName);
// if we generated a model with a non-object type because it has validations or enums,
// make sure that the datatype of that body parameter refers to our model class
Content content = body.getContent();
Set<String> keySet = content.keySet();
Object[] keyArray = (Object[]) keySet.toArray();
MediaType mediaType = content.get(keyArray[0]);
Schema schema = mediaType.getSchema();
String ref = schema.get$ref();
if (ref == null) {
return result;
}
String modelName = ModelUtils.getSimpleRef(ref);
// the result lacks validation info so we need to make a CodegenProperty from the schema to check
// if we have validation and enum info exists
Schema realSchema = ModelUtils.getSchema(this.openAPI, modelName);
CodegenProperty modelProp = fromProperty("body", realSchema);
if (modelProp.isPrimitiveType && (modelProp.hasValidation || modelProp.isEnum)) {
String simpleDataType = result.dataType;
result.isPrimitiveType = false;
result.isModel = true;
result.dataType = modelName;
imports.add(modelName);
// set the example value
if (modelProp.isEnum) {
String value = modelProp._enum.get(0).toString();
result.example = modelName + "(" + toEnumValue(value, simpleDataType) + ")";
} else {
result.example = modelName + "(" + result.example + ")";
}
}
return result;
}
/**
* Convert OAS Response object to Codegen Response object
*
* @param responseCode HTTP response code
* @param response OAS Response object
* @return Codegen Response object
*/
@Override
public CodegenResponse fromResponse(String responseCode, ApiResponse response) {
// if a response points at a model whose type != object and it has validations and/or enums, then we will
// generate the model, and the response.isModel must be changed to true and response.baseType must be the name
// of the model. Point responses at models if the model is python class type ModelSimple
// When we serialize/deserialize ModelSimple models, validations and enums will be checked.
Schema responseSchema;
if (this.openAPI != null && this.openAPI.getComponents() != null) {
responseSchema = ModelUtils.unaliasSchema(this.openAPI, ModelUtils.getSchemaFromResponse(response));
} else { // no model/alias defined
responseSchema = ModelUtils.getSchemaFromResponse(response);
}
String newBaseType = null;
if (responseSchema != null) {
CodegenProperty cp = fromProperty("response", responseSchema);
if (cp.complexType != null) {
// check the referenced schema to see if it is an type=object model
Schema modelSchema = ModelUtils.getSchema(this.openAPI, cp.complexType);
if (modelSchema != null && !"object".equals(modelSchema.getType())) {
CodegenProperty modelProp = fromProperty("response", modelSchema);
if (modelProp.isEnum == true || modelProp.hasValidation == true) {
// this model has validations and/or enums so we will generate it
newBaseType = cp.complexType;
}
}
} else {
if (cp.isEnum == true || cp.hasValidation == true) {
// this model has validations and/or enums so we will generate it
Schema sc = ModelUtils.getSchemaFromResponse(response);
newBaseType = ModelUtils.getSimpleRef(sc.get$ref());
}
}
}
CodegenResponse result = super.fromResponse(responseCode, response);
if (newBaseType != null) {
result.isModel = true;
result.baseType = newBaseType;
result.dataType = newBaseType;
}
return result;
}
/**
* Set op's returnBaseType, returnType, examples etc.
*
* @param operation endpoint Operation
* @param schemas a map of the schemas in the openapi spec
* @param op endpoint CodegenOperation
* @param methodResponse the default ApiResponse for the endpoint
*/
@Override
public void handleMethodResponse(Operation operation,
Map<String, Schema> schemas,
CodegenOperation op,
ApiResponse methodResponse) {
// we have a custom version of this method to handle endpoints that return models where
// type != object the model has validations and/or enums
// we do this by invoking our custom fromResponse method to create defaultResponse
// which we then use to set op.returnType and op.returnBaseType
CodegenResponse defaultResponse = fromResponse("defaultResponse", methodResponse);
Schema responseSchema = ModelUtils.unaliasSchema(this.openAPI, ModelUtils.getSchemaFromResponse(methodResponse));
if (responseSchema != null) {
op.returnBaseType = defaultResponse.baseType;
// generate examples
String exampleStatusCode = "200";
for (String key : operation.getResponses().keySet()) {
if (operation.getResponses().get(key) == methodResponse && !key.equals("default")) {
exampleStatusCode = key;
}
}
op.examples = new ExampleGenerator(schemas, this.openAPI).generateFromResponseSchema(exampleStatusCode, responseSchema, getProducesInfo(this.openAPI, operation));
op.defaultResponse = toDefaultValue(responseSchema);
op.returnType = defaultResponse.dataType;
op.hasReference = schemas.containsKey(op.returnBaseType);
// lookup discriminator
Schema schema = schemas.get(op.returnBaseType);
if (schema != null) {
CodegenModel cmod = fromModel(op.returnBaseType, schema);
op.discriminator = cmod.discriminator;
}
if (defaultResponse.isListContainer) {
op.isListContainer = true;
} else if (defaultResponse.isMapContainer) {
op.isMapContainer = true;
} else {
op.returnSimpleType = true;
}
if (languageSpecificPrimitives().contains(op.returnBaseType) || op.returnBaseType == null) {
op.returnTypeIsPrimitive = true;
}
}
addHeaders(methodResponse, op.responseHeaders);
}
/**
* Return the sanitized variable name for enum
*
* @param value enum variable name
* @param datatype data type
* @return the sanitized variable name for enum
*/
public String toEnumVarName(String value, String datatype) {
// our enum var names are keys in a python dict, so change spaces to underscores
if (value.length() == 0) {
return "EMPTY";
}
String var = value.replaceAll("\\s+", "_").toUpperCase(Locale.ROOT);
return var;
}
/**
* Return the enum value in the language specified format
* e.g. status becomes "status"
*
* @param value enum variable name
* @param datatype data type
* @return the sanitized value for enum
*/
public String toEnumValue(String value, String datatype) {
if (datatype.equals("int") || datatype.equals("float")) {
return value;
} else {
return "\"" + escapeText(value) + "\"";
}
}
@Override
public void postProcessParameter(CodegenParameter parameter) {
postProcessPattern(parameter.pattern, parameter.vendorExtensions);
}
/**
* Convert OAS Model object to Codegen Model object
*
* @param name the name of the model
* @param schema OAS Model object
* @return Codegen Model object
*/
@Override
public CodegenModel fromModel(String name, Schema schema) {
// we have a custom version of this function so we can produce
// models for components whose type != object and which have validations and enums
// this ensures that endpoint (operation) responses with validations and enums
// will generate models, and when those endpoint responses are received in python
// the response is cast as a model, and the model will validate the response using the enums and validations
Map<String, String> propertyToModelName = new HashMap<String, String>();
Map<String, Schema> propertiesMap = schema.getProperties();
if (propertiesMap != null) {
for (Map.Entry<String, Schema> entry : propertiesMap.entrySet()) {
String schemaPropertyName = entry.getKey();
String pythonPropertyName = toVarName(schemaPropertyName);
Schema propertySchema = entry.getValue();
String ref = propertySchema.get$ref();
if (ref == null) {
continue;
}
Schema refSchema = ModelUtils.getReferencedSchema(this.openAPI, propertySchema);
String refType = refSchema.getType();
if (refType == null || refType.equals("object")) {
continue;
}
CodegenProperty modelProperty = fromProperty("_fake_name", refSchema);
if (modelProperty.isEnum == false && modelProperty.hasValidation == false) {
continue;
}
String modelName = ModelUtils.getSimpleRef(ref);
propertyToModelName.put(pythonPropertyName, modelName);
}
}
CodegenModel result = super.fromModel(name, schema);
// make non-object type models have one property so we can use it to store enums and validations
if (result.isAlias || result.isEnum) {
Schema modelSchema = ModelUtils.getSchema(this.openAPI, result.name);
CodegenProperty modelProperty = fromProperty("value", modelSchema);
if (modelProperty.isEnum == true || modelProperty.hasValidation == true) {
// these models are non-object models with enums and/or validations
// add a single property to the model so we can have a way to access validations
result.isAlias = true;
modelProperty.required = true;
List<CodegenProperty> theProperties = Arrays.asList(modelProperty);
result.setAllVars(theProperties);
result.setVars(theProperties);
result.setRequiredVars(theProperties);
// post process model properties
if (result.vars != null) {
for (CodegenProperty prop : result.vars) {
postProcessModelProperty(result, prop);
}
}
}
}
// return all models which don't need their properties connected to non-object models
if (propertyToModelName.isEmpty()) {
return result;
}
// fix all property references to non-object models, make those properties non-primitive and
// set their dataType and complexType to the model name, so documentation will refer to the correct model
ArrayList<List<CodegenProperty>> listOfLists= new ArrayList<List<CodegenProperty>>();
listOfLists.add(result.vars);
listOfLists.add(result.allVars);
listOfLists.add(result.requiredVars);
listOfLists.add(result.optionalVars);
listOfLists.add(result.readOnlyVars);
listOfLists.add(result.readWriteVars);
for (List<CodegenProperty> cpList : listOfLists) {
for (CodegenProperty cp : cpList) {
if (!propertyToModelName.containsKey(cp.name)) {
continue;
}
cp.isPrimitiveType = false;
String modelName = propertyToModelName.get(cp.name);
cp.complexType = modelName;
cp.dataType = modelName;
cp.isEnum = false;
cp.hasValidation = false;
}
}
return result;
}
}

View File

@ -10,10 +10,14 @@ import re # noqa: F401
import six
from {{packageName}}.api_client import ApiClient
from {{packageName}}.exceptions import ( # noqa: F401
from {{packageName}}.exceptions import (
ApiTypeError,
ApiValueError
)
from {{packageName}}.model_utils import (
check_allowed_values,
check_validations
)
{{#operations}}
@ -30,265 +34,384 @@ class {{classname}}(object):
self.api_client = api_client
{{#operation}}
def {{operationId}}(self{{#requiredParams}}{{^defaultValue}}, {{paramName}}{{/defaultValue}}{{/requiredParams}}{{#requiredParams}}{{#defaultValue}}, {{paramName}}={{{defaultValue}}}{{/defaultValue}}{{/requiredParams}}, **kwargs): # noqa: E501
"""{{#summary}}{{{.}}}{{/summary}}{{^summary}}{{operationId}}{{/summary}} # noqa: E501
def __{{operationId}}(self, {{#sortParamsByRequiredFlag}}{{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}{{/sortParamsByRequiredFlag}}**kwargs): # noqa: E501
"""{{#summary}}{{{.}}}{{/summary}}{{^summary}}{{operationId}}{{/summary}} # noqa: E501
{{#notes}}
{{{notes}}} # noqa: E501
{{{notes}}} # noqa: E501
{{/notes}}
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.{{operationId}}({{#requiredParams}}{{^defaultValue}}{{paramName}}, {{/defaultValue}}{{/requiredParams}}{{#requiredParams}}{{#defaultValue}}{{paramName}}={{{defaultValue}}}, {{/defaultValue}}{{/requiredParams}}async_req=True)
>>> result = thread.get()
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
{{#sortParamsByRequiredFlag}}
>>> thread = api.{{operationId}}({{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}async_req=True)
{{/sortParamsByRequiredFlag}}
{{^sortParamsByRequiredFlag}}
>>> thread = api.{{operationId}}({{#allParams}}{{#required}}{{paramName}}={{paramName}}_value, {{/required}}{{/allParams}}async_req=True)
{{/sortParamsByRequiredFlag}}
>>> result = thread.get()
{{#requiredParams}}
{{^hasMore}}
Args:
{{/hasMore}}
{{/requiredParams}}
{{#requiredParams}}
{{^defaultValue}}
{{paramName}} ({{dataType}}):{{#description}} {{description}}{{/description}}{{/defaultValue}}{{/requiredParams}}{{#requiredParams}}{{#defaultValue}}
{{paramName}} ({{dataType}}):{{#description}} {{description}}.{{/description}} defaults to {{{defaultValue}}}, must be one of [{{{defaultValue}}}]{{/defaultValue}}{{/requiredParams}}
Keyword Args:{{#optionalParams}}
{{paramName}} ({{dataType}}):{{#description}} {{description}}.{{/description}} [optional]{{#defaultValue}} if omitted the server will use the default value of {{{defaultValue}}}{{/defaultValue}}{{/optionalParams}}
async_req (bool): execute request asynchronously
param _preload_content (bool): if False, the urllib3.HTTPResponse
object will be returned without reading/decoding response data.
Default is True.
param _request_timeout (float/tuple): timeout setting for this
request. If one number provided, it will be total request
timeout. It can also be a pair (tuple) of (connection, read)
timeouts.
Returns:
{{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}None{{/returnType}}:
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.{{operationId}}_with_http_info({{#requiredParams}}{{^defaultValue}}{{paramName}}, {{/defaultValue}}{{/requiredParams}}{{#requiredParams}}{{#defaultValue}}{{paramName}}={{paramName}}, {{/defaultValue}}{{/requiredParams}}**kwargs) # noqa: E501
else:
(data) = self.{{operationId}}_with_http_info({{#requiredParams}}{{^defaultValue}}{{paramName}}, {{/defaultValue}}{{/requiredParams}}{{#requiredParams}}{{#defaultValue}}{{paramName}}={{paramName}}, {{/defaultValue}}{{/requiredParams}}**kwargs) # noqa: E501
return data
def {{operationId}}_with_http_info(self{{#requiredParams}}{{^defaultValue}}, {{paramName}}{{/defaultValue}}{{/requiredParams}}{{#requiredParams}}{{#defaultValue}}, {{paramName}}=None{{/defaultValue}}{{/requiredParams}}, **kwargs): # noqa: E501
"""{{#summary}}{{{.}}}{{/summary}}{{^summary}}{{operationId}}{{/summary}} # noqa: E501
{{#notes}}
{{{notes}}} # noqa: E501
{{/notes}}
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.{{operationId}}_with_http_info({{#requiredParams}}{{^defaultValue}}{{paramName}}, {{/defaultValue}}{{/requiredParams}}async_req=True)
>>> result = thread.get()
{{#requiredParams}}
{{^hasMore}}
Args:
{{/hasMore}}
{{/requiredParams}}
{{#requiredParams}}
{{^defaultValue}}
{{paramName}} ({{dataType}}):{{#description}} {{description}}{{/description}}{{/defaultValue}}{{/requiredParams}}{{#requiredParams}}{{#defaultValue}}
{{paramName}} ({{dataType}}):{{#description}} {{description}}.{{/description}} defaults to {{{defaultValue}}}, must be one of [{{{defaultValue}}}]{{/defaultValue}}{{/requiredParams}}
Keyword Args:{{#optionalParams}}
{{paramName}} ({{dataType}}):{{#description}} {{description}}.{{/description}} [optional]{{#defaultValue}} if omitted the server will use the default value of {{{defaultValue}}}{{/defaultValue}}{{/optionalParams}}
async_req (bool): execute request asynchronously
param _preload_content (bool): if False, the urllib3.HTTPResponse
object will be returned without reading/decoding response data.
Default is True.
param _request_timeout (float/tuple): timeout setting for this
request. If one number provided, it will be total request
timeout. It can also be a pair (tuple) of (connection, read)
timeouts.
Returns:
{{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}None{{/returnType}}:
"""
{{#servers.0}}
local_var_hosts = [{{#servers}}
'{{{url}}}'{{^-last}},{{/-last}}{{/servers}}
]
local_var_host = local_var_hosts[0]
if kwargs.get('_host_index'):
if (int(kwargs.get('_host_index')) < 0 or
int(kwargs.get('_host_index')) >= len(local_var_hosts)):
raise ApiValueError(
"Invalid host index. Must be 0 <= index < %s" %
len(local_var_host)
)
local_var_host = local_var_hosts[int(kwargs.get('_host_index'))]
{{/servers.0}}
local_var_params = locals()
all_params = [{{#allParams}}'{{paramName}}'{{#hasMore}}, {{/hasMore}}{{/allParams}}] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
for key, val in six.iteritems(local_var_params['kwargs']):
if key not in all_params{{#servers.0}} and key != "_host_index"{{/servers.0}}:
raise ApiTypeError(
"Got an unexpected keyword argument '%s'"
" to method {{operationId}}" % key
)
local_var_params[key] = val
del local_var_params['kwargs']
:param async_req bool: execute request asynchronously
{{#allParams}}
{{^isNullable}}
{{#required}}
# verify the required parameter '{{paramName}}' is set
if ('{{paramName}}' not in local_var_params or
local_var_params['{{paramName}}'] is None):
raise ApiValueError("Missing the required parameter `{{paramName}}` when calling `{{operationId}}`") # noqa: E501
{{/required}}
{{/isNullable}}
{{#-last}}
{{/-last}}
:param {{dataType}} {{paramName}}:{{#description}} {{{description}}}{{/description}}{{#required}} (required){{/required}}{{#optional}}(optional){{/optional}}
{{/allParams}}
:param _return_http_data_only: response data without head status
code and headers
:param _preload_content: if False, the urllib3.HTTPResponse object
will be returned without reading/decoding response data.
Default is True.
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request timeout. It can also
be a pair (tuple) of (connection, read) timeouts.
:return: {{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}None{{/returnType}}
If the method is called asynchronously, returns the request
thread.
"""
kwargs['_return_http_data_only'] = kwargs.get(
'_return_http_data_only', True
)
{{#requiredParams}}
kwargs['{{paramName}}'] = {{paramName}}
{{/requiredParams}}
return self.call_with_http_info(**kwargs)
self.{{operationId}} = Endpoint(
settings={
'response_type': {{#returnType}}'{{returnType}}'{{/returnType}}{{^returnType}}None{{/returnType}},
{{#authMethods}}
{{#-first}}
'auth': [
{{/-first}}
'{{name}}'{{#hasMore}}, {{/hasMore}}
{{#-last}}
],
{{/-last}}
{{/authMethods}}
{{^authMethods}}
'auth': [],
{{/authMethods}}
'endpoint_path': '{{{path}}}',
'operation_id': '{{operationId}}',
'http_method': '{{httpMethod}}',
{{#servers}}
{{#-first}}
'servers': [
{{/-first}}
'{{{url}}}'{{^-last}},{{/-last}}
{{#-last}}
]
{{/-last}}
{{/servers}}
{{^servers}}
'servers': [],
{{/servers}}
},
params_map={
'all': [
{{#allParams}}
'{{paramName}}',
{{/allParams}}
],
{{#requiredParams}}
{{#-first}}
'required': [
{{/-first}}
'{{paramName}}',
{{#-last}}
],
{{/-last}}
{{/requiredParams}}
{{^requiredParams}}
'required': [],
{{/requiredParams}}
'nullable': [
{{#allParams}}
{{#isNullable}}
'{{paramName}}',
{{/isNullable}}
{{/allParams}}
],
'enum': [
{{#allParams}}
{{#isEnum}}
{{#isContainer}}
allowed_values = [{{#allowableValues}}{{#values}}{{#items.isString}}"{{/items.isString}}{{{this}}}{{#items.isString}}"{{/items.isString}}{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}] # noqa: E501
{{#isListContainer}}
if ('{{{paramName}}}' in local_var_params and
not set(local_var_params['{{{paramName}}}']).issubset(set(allowed_values))): # noqa: E501
raise ValueError(
"Invalid values for `{{{paramName}}}` [{0}], must be a subset of [{1}]" # noqa: E501
.format(", ".join(map(str, set(local_var_params['{{{paramName}}}']) - set(allowed_values))), # noqa: E501
", ".join(map(str, allowed_values)))
)
{{/isListContainer}}
{{#isMapContainer}}
if ('{{{paramName}}}' in local_var_params and
not set(local_var_params['{{{paramName}}}'].keys()).issubset(set(allowed_values))):
raise ValueError(
"Invalid keys in `{{{paramName}}}` [{0}], must be a subset of [{1}]" # noqa: E501
.format(", ".join(map(str, set(local_var_params['{{{paramName}}}'].keys()) - set(allowed_values))), # noqa: E501
", ".join(map(str, allowed_values)))
)
{{/isMapContainer}}
{{/isContainer}}
{{^isContainer}}
allowed_values = [{{#allowableValues}}{{#values}}{{#isString}}"{{/isString}}{{{this}}}{{#isString}}"{{/isString}}{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}] # noqa: E501
if ('{{{paramName}}}' in local_var_params and
local_var_params['{{{paramName}}}'] not in allowed_values):
raise ValueError(
"Invalid value for `{{{paramName}}}` ({0}), must be one of {1}" # noqa: E501
.format(local_var_params['{{{paramName}}}'], allowed_values)
)
{{/isContainer}}
'{{paramName}}',
{{/isEnum}}
{{/allParams}}
],
'validation': [
{{#allParams}}
{{#hasValidation}}
{{#maxLength}}
if ('{{paramName}}' in local_var_params and
len(local_var_params['{{paramName}}']) > {{maxLength}}):
raise ApiValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, length must be less than or equal to `{{maxLength}}`") # noqa: E501
{{/maxLength}}
{{#minLength}}
if ('{{paramName}}' in local_var_params and
len(local_var_params['{{paramName}}']) < {{minLength}}):
raise ApiValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, length must be greater than or equal to `{{minLength}}`") # noqa: E501
{{/minLength}}
{{#maximum}}
if '{{paramName}}' in local_var_params and local_var_params['{{paramName}}'] >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{maximum}}: # noqa: E501
raise ApiValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, must be a value less than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}`{{maximum}}`") # noqa: E501
{{/maximum}}
{{#minimum}}
if '{{paramName}}' in local_var_params and local_var_params['{{paramName}}'] <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{minimum}}: # noqa: E501
raise ApiValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, must be a value greater than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}`{{minimum}}`") # noqa: E501
{{/minimum}}
{{#pattern}}
if '{{paramName}}' in local_var_params and not re.search(r'{{{vendorExtensions.x-regex}}}', local_var_params['{{paramName}}']{{#vendorExtensions.x-modifiers}}{{#-first}}, flags={{/-first}}re.{{.}}{{^-last}} | {{/-last}}{{/vendorExtensions.x-modifiers}}): # noqa: E501
raise ApiValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, must conform to the pattern `{{{pattern}}}`") # noqa: E501
{{/pattern}}
{{#maxItems}}
if ('{{paramName}}' in local_var_params and
len(local_var_params['{{paramName}}']) > {{maxItems}}):
raise ApiValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, number of items must be less than or equal to `{{maxItems}}`") # noqa: E501
{{/maxItems}}
{{#minItems}}
if ('{{paramName}}' in local_var_params and
len(local_var_params['{{paramName}}']) < {{minItems}}):
raise ApiValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, number of items must be greater than or equal to `{{minItems}}`") # noqa: E501
{{/minItems}}
'{{paramName}}',
{{/hasValidation}}
{{/allParams}}
collection_formats = {}
path_params = {}
{{#pathParams}}
if '{{paramName}}' in local_var_params:
path_params['{{baseName}}'] = local_var_params['{{paramName}}']{{#isListContainer}} # noqa: E501
collection_formats['{{baseName}}'] = '{{collectionFormat}}'{{/isListContainer}} # noqa: E501
{{/pathParams}}
query_params = []
{{#queryParams}}
if '{{paramName}}' in local_var_params:
query_params.append(('{{baseName}}', local_var_params['{{paramName}}'])){{#isListContainer}} # noqa: E501
collection_formats['{{baseName}}'] = '{{collectionFormat}}'{{/isListContainer}} # noqa: E501
{{/queryParams}}
header_params = {}
{{#headerParams}}
if '{{paramName}}' in local_var_params:
header_params['{{baseName}}'] = local_var_params['{{paramName}}']{{#isListContainer}} # noqa: E501
collection_formats['{{baseName}}'] = '{{collectionFormat}}'{{/isListContainer}} # noqa: E501
{{/headerParams}}
form_params = []
local_var_files = {}
{{#formParams}}
if '{{paramName}}' in local_var_params:
{{^isFile}}form_params.append(('{{baseName}}', local_var_params['{{paramName}}'])){{/isFile}}{{#isFile}}local_var_files['{{baseName}}'] = local_var_params['{{paramName}}']{{/isFile}}{{#isListContainer}} # noqa: E501
collection_formats['{{baseName}}'] = '{{collectionFormat}}'{{/isListContainer}} # noqa: E501
{{/formParams}}
body_params = None
{{#bodyParam}}
if '{{paramName}}' in local_var_params:
body_params = local_var_params['{{paramName}}']
{{/bodyParam}}
{{#hasProduces}}
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
[{{#produces}}'{{{mediaType}}}'{{#hasMore}}, {{/hasMore}}{{/produces}}]) # noqa: E501
{{/hasProduces}}
{{#hasConsumes}}
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
[{{#consumes}}'{{{mediaType}}}'{{#hasMore}}, {{/hasMore}}{{/consumes}}]) # noqa: E501
{{/hasConsumes}}
# Authentication setting
auth_settings = [{{#authMethods}}'{{name}}'{{#hasMore}}, {{/hasMore}}{{/authMethods}}] # noqa: E501
return self.api_client.call_api(
'{{{path}}}', '{{httpMethod}}',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type={{#returnType}}'{{returnType}}'{{/returnType}}{{^returnType}}None{{/returnType}}, # noqa: E501
auth_settings=auth_settings,
async_req=local_var_params.get('async_req'),
_return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
_preload_content=local_var_params.get('_preload_content', True),
_request_timeout=local_var_params.get('_request_timeout'),
{{#servers.0}}
_host=local_var_host,
{{/servers.0}}
collection_formats=collection_formats)
]
},
root_map={
'validations': {
{{#allParams}}
{{#hasValidation}}
('{{paramName}}',): {
{{#maxLength}}
'max_length': {{maxLength}},{{/maxLength}}{{#minLength}}
'min_length': {{minLength}},{{/minLength}}{{#maxItems}}
'max_items': {{maxItems}},{{/maxItems}}{{#minItems}}
'min_items': {{minItems}},{{/minItems}}{{#maximum}}
{{#exclusiveMaximum}}'exclusive_maximum'{{/exclusiveMaximum}}'inclusive_maximum'{{^exclusiveMaximum}}{{/exclusiveMaximum}}: {{maximum}},{{/maximum}}{{#minimum}}
{{#exclusiveMinimum}}'exclusive_minimum'{{/exclusiveMinimum}}'inclusive_minimum'{{^exclusiveMinimum}}{{/exclusiveMinimum}}: {{minimum}},{{/minimum}}{{#pattern}}
'regex': {
'pattern': r'{{{vendorExtensions.x-regex}}}', # noqa: E501{{#vendorExtensions.x-modifiers}}
{{#-first}}'flags': (re.{{.}}{{/-first}}{{^-first}} re.{{.}}{{/-first}}{{^-last}} | {{/-last}}{{#-last}}){{/-last}}{{/vendorExtensions.x-modifiers}}
},{{/pattern}}
},
{{/hasValidation}}
{{/allParams}}
},
'allowed_values': {
{{#allParams}}
{{#isEnum}}
('{{paramName}}',): {
{{#isNullable}}
'None': None,{{/isNullable}}{{#allowableValues}}{{#enumVars}}
"{{name}}": {{{value}}}{{^-last}},{{/-last}}{{/enumVars}}{{/allowableValues}}
},
{{/isEnum}}
{{/allParams}}
},
'openapi_types': {
{{#allParams}}
'{{paramName}}': '{{dataType}}',
{{/allParams}}
},
'attribute_map': {
{{#allParams}}
{{^isBodyParam}}
'{{paramName}}': '{{baseName}}',
{{/isBodyParam}}
{{/allParams}}
},
'location_map': {
{{#allParams}}
'{{paramName}}': '{{#isFormParam}}form{{/isFormParam}}{{#isQueryParam}}query{{/isQueryParam}}{{#isPathParam}}path{{/isPathParam}}{{#isHeaderParam}}header{{/isHeaderParam}}{{#isCookieParam}}cookie{{/isCookieParam}}{{#isBodyParam}}body{{/isBodyParam}}',
{{/allParams}}
},
'collection_format_map': {
{{#allParams}}
{{#collectionFormat}}
'{{paramName}}': '{{collectionFormat}}',
{{/collectionFormat}}
{{/allParams}}
}
},
headers_map={
{{#hasProduces}}
'accept': [
{{#produces}}
'{{{mediaType}}}'{{#hasMore}},{{/hasMore}}
{{/produces}}
],
{{/hasProduces}}
{{^hasProduces}}
'accept': [],
{{/hasProduces}}
{{#hasConsumes}}
'content_type': [
{{#consumes}}
'{{{mediaType}}}'{{#hasMore}},{{/hasMore}}
{{/consumes}}
]
{{/hasConsumes}}
{{^hasConsumes}}
'content_type': [],
{{/hasConsumes}}
},
api_client=api_client,
callable=__{{operationId}}
)
{{/operation}}
{{/operations}}
class Endpoint(object):
def __init__(self, settings=None, params_map=None, root_map=None,
headers_map=None, api_client=None, callable=None):
"""Creates an endpoint
Args:
settings (dict): see below key value pairs
'response_type' (str): response type
'auth' (list): a list of auth type keys
'endpoint_path' (str): the endpoint path
'operation_id' (str): endpoint string identifier
'http_method' (str): POST/PUT/PATCH/GET etc
'servers' (list): list of str servers that this endpoint is at
params_map (dict): see below key value pairs
'all' (list): list of str endpoint parameter names
'required' (list): list of required parameter names
'nullable' (list): list of nullable parameter names
'enum' (list): list of parameters with enum values
'validation' (list): list of parameters with validations
root_map
'validations' (dict): the dict mapping endpoint parameter tuple
paths to their validation dictionaries
'allowed_values' (dict): the dict mapping endpoint parameter
tuple paths to their allowed_values (enum) dictionaries
'openapi_types' (dict): param_name to openapi type
'attribute_map' (dict): param_name to camelCase name
'location_map' (dict): param_name to 'body', 'file', 'form',
'header', 'path', 'query'
collection_format_map (dict): param_name to `csv` etc.
headers_map (dict): see below key value pairs
'accept' (list): list of Accept header strings
'content_type' (list): list of Content-Type header strings
api_client (ApiClient) api client instance
callable (function): the function which is invoked when the
Endpoint is called
"""
self.settings = settings
self.params_map = params_map
self.params_map['all'].extend([
'async_req',
'_host_index',
'_preload_content',
'_request_timeout',
'_return_http_data_only'
])
self.validations = root_map['validations']
self.allowed_values = root_map['allowed_values']
self.openapi_types = root_map['openapi_types']
self.attribute_map = root_map['attribute_map']
self.location_map = root_map['location_map']
self.collection_format_map = root_map['collection_format_map']
self.headers_map = headers_map
self.api_client = api_client
self.callable = callable
def __validate_inputs(self, kwargs):
for param in self.params_map['enum']:
if param in kwargs:
check_allowed_values(
self.allowed_values,
(param,),
kwargs[param],
self.validations
)
for param in self.params_map['validation']:
if param in kwargs:
check_validations(
self.validations,
(param,),
kwargs[param]
)
def __gather_params(self, kwargs):
params = {
'body': None,
'collection_format': {},
'file': {},
'form': [],
'header': {},
'path': {},
'query': []
}
for param_name, param_value in six.iteritems(kwargs):
param_location = self.location_map.get(param_name)
if param_location:
if param_location == 'body':
params['body'] = param_value
continue
base_name = self.attribute_map[param_name]
if (param_location == 'form' and
self.openapi_types[param_name] == 'file'):
param_location = 'file'
elif param_location in {'form', 'query'}:
param_value_full = (base_name, param_value)
params[param_location].append(param_value_full)
if param_location not in {'form', 'query'}:
params[param_location][base_name] = param_value
collection_format = self.collection_format_map.get(param_name)
if collection_format:
params['collection_format'][base_name] = collection_format
return params
def __call__(self, *args, **kwargs):
""" This method is invoked when endpoints are called
Example:
pet_api = PetApi()
pet_api.add_pet # this is an instance of the class Endpoint
pet_api.add_pet() # this invokes pet_api.add_pet.__call__()
which then invokes the callable functions stored in that endpoint at
pet_api.add_pet.callable or self.callable in this class
"""
return self.callable(self, *args, **kwargs)
def call_with_http_info(self, **kwargs):
if kwargs.get('_host_index') and self.settings['servers']:
_host_index = kwargs.get('_host_index')
try:
_host = self.settings['servers'][_host_index]
except IndexError:
raise ApiValueError(
"Invalid host index. Must be 0 <= index < %s" %
len(self.settings['servers'])
)
else:
try:
_host = self.settings['servers'][0]
except IndexError:
_host = None
for key, value in six.iteritems(kwargs):
if key not in self.params_map['all']:
raise ApiTypeError(
"Got an unexpected parameter '%s'"
" to method `%s`" %
(key, self.settings['operation_id'])
)
if key not in self.params_map['nullable'] and value is None:
raise ApiValueError(
"Value may not be None for non-nullable parameter `%s`"
" when calling `%s`" %
(key, self.settings['operation_id'])
)
for key in self.params_map['required']:
if key not in kwargs.keys():
raise ApiValueError(
"Missing the required parameter `%s` when calling "
"`%s`" % (key, self.settings['operation_id'])
)
self.__validate_inputs(kwargs)
params = self.__gather_params(kwargs)
accept_headers_list = self.headers_map['accept']
if accept_headers_list:
params['header']['Accept'] = self.api_client.select_header_accept(
accept_headers_list)
content_type_headers_list = self.headers_map['content_type']
if content_type_headers_list:
header_list = self.api_client.select_header_content_type(
content_type_headers_list)
params['header']['Content-Type'] = header_list
return self.api_client.call_api(
self.settings['endpoint_path'], self.settings['http_method'],
params['path'],
params['query'],
params['header'],
body=params['body'],
post_params=params['form'],
files=params['file'],
response_type=self.settings['response_type'],
auth_settings=self.settings['auth'],
async_req=kwargs.get('async_req'),
_return_http_data_only=kwargs.get('_return_http_data_only'),
_preload_content=kwargs.get('_preload_content', True),
_request_timeout=kwargs.get('_request_timeout'),
_host=_host,
collection_formats=params['collection_format'])

View File

@ -18,9 +18,13 @@ from six.moves.urllib.parse import quote
import tornado.gen
{{/tornado}}
from {{packageName}}.configuration import Configuration
import {{modelPackage}}
from {{packageName}} import rest
from {{packageName}}.configuration import Configuration
from {{packageName}}.model_utils import (
ModelNormal,
ModelSimple
)
from {{packageName}}.exceptions import ApiValueError
@ -224,7 +228,7 @@ class ApiClient(object):
if isinstance(obj, dict):
obj_dict = obj
else:
elif isinstance(obj, ModelNormal):
# Convert model obj to dict except
# attributes `openapi_types`, `attribute_map`
# and attributes which value is not None.
@ -233,6 +237,8 @@ class ApiClient(object):
obj_dict = {obj.attribute_map[attr]: getattr(obj, attr)
for attr, _ in six.iteritems(obj.openapi_types)
if getattr(obj, attr) is not None}
elif isinstance(obj, ModelSimple):
return self.sanitize_for_serialization(obj.value)
return {key: self.sanitize_for_serialization(val)
for key, val in six.iteritems(obj_dict)}
@ -571,6 +577,8 @@ class ApiClient(object):
return six.text_type(data)
except TypeError:
return data
except ValueError as exc:
raise ApiValueError(str(exc))
def __deserialize_object(self, value):
"""Return an original value.
@ -622,14 +630,15 @@ class ApiClient(object):
"""Deserializes list or dict to model.
:param data: dict, list.
:param klass: class literal.
:param klass: class literal, ModelSimple or ModelNormal
:return: model object.
"""
if not klass.openapi_types and not hasattr(klass,
'get_real_child_model'):
return data
if issubclass(klass, ModelSimple):
value = self.__deserialize(data, klass.openapi_types['value'])
return klass(value)
# code to handle ModelNormal
used_data = data
if not isinstance(data, (list, dict)):
used_data = [data]
@ -641,13 +650,11 @@ class ApiClient(object):
klass.attribute_map[attr] in used_data):
value = used_data[klass.attribute_map[attr]]
keyword_args[attr] = self.__deserialize(value, attr_type)
end_index = None
argspec = inspect.getargspec(getattr(klass, '__init__'))
if argspec.defaults:
end_index = -len(argspec.defaults)
required_positional_args = argspec.args[1:end_index]
for index, req_positional_arg in enumerate(required_positional_args):
if keyword_args and req_positional_arg in keyword_args:
positional_args.append(keyword_args[req_positional_arg])
@ -655,9 +662,7 @@ class ApiClient(object):
elif (not keyword_args and index < len(used_data) and
isinstance(used_data, list)):
positional_args.append(used_data[index])
instance = klass(*positional_args, **keyword_args)
if hasattr(instance, 'get_real_child_model'):
klass_name = instance.get_real_child_model(data)
if klass_name:

View File

@ -2,240 +2,34 @@
{{>partial_header}}
import pprint
import pprint # noqa: F401
import re # noqa: F401
import six
import six # noqa: F401
from {{packageName}}.exceptions import ApiValueError # noqa: F401
from {{packageName}}.model_utils import ( # noqa: F401
ModelNormal,
ModelSimple,
check_allowed_values,
check_validations
)
{{#models}}
{{#model}}
class {{classname}}(object):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
"""{{#allowableValues}}
"""
allowed enum values
"""
{{#enumVars}}
{{name}} = {{{value}}}{{^-last}}
{{^interfaces}}
{{#isAlias}}
{{> python-experimental/model_templates/model_simple }}
{{/isAlias}}
{{^isAlias}}
{{> python-experimental/model_templates/model_normal }}
{{/isAlias}}
{{/interfaces}}
{{#interfaces}}
{{#-last}}
{{> python-experimental/model_templates/model_normal }}
{{/-last}}
{{/enumVars}}{{/allowableValues}}
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
openapi_types = {
{{#requiredVars}}
'{{name}}': '{{{dataType}}}',
{{/requiredVars}}
{{#optionalVars}}
'{{name}}': '{{{dataType}}}',
{{/optionalVars}}
}
attribute_map = {
{{#requiredVars}}
'{{name}}': '{{baseName}}', # noqa: E501
{{/requiredVars}}
{{#optionalVars}}
'{{name}}': '{{baseName}}', # noqa: E501
{{/optionalVars}}
}
{{#discriminator}}
discriminator_value_class_map = {
{{#children}}'{{^vendorExtensions.x-discriminator-value}}{{name}}{{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-discriminator-value}}{{{vendorExtensions.x-discriminator-value}}}{{/vendorExtensions.x-discriminator-value}}': '{{{classname}}}'{{^-last}},
{{/-last}}{{/children}}
}
{{/discriminator}}
def __init__(self{{#requiredVars}}{{^defaultValue}}, {{name}}{{/defaultValue}}{{/requiredVars}}{{#requiredVars}}{{#defaultValue}}, {{name}}={{{defaultValue}}}{{/defaultValue}}{{/requiredVars}}{{#optionalVars}}, {{name}}=None{{/optionalVars}}): # noqa: E501
"""{{classname}} - a model defined in OpenAPI
{{#requiredVars}}{{^hasMore}} Args:{{/hasMore}}{{/requiredVars}}{{#requiredVars}}{{^defaultValue}}
{{name}} ({{dataType}}):{{#description}} {{description}}{{/description}}{{/defaultValue}}{{/requiredVars}}
Keyword Args:{{#requiredVars}}{{#defaultValue}}
{{name}} ({{dataType}}):{{#description}} {{description}}.{{/description}} defaults to {{{defaultValue}}}, must be one of [{{{defaultValue}}}]{{/defaultValue}} # noqa: E501{{/requiredVars}}{{#optionalVars}}
{{name}} ({{dataType}}):{{#description}} {{description}}.{{/description}} [optional]{{#defaultValue}} if omitted the server will use the default value of {{{defaultValue}}}{{/defaultValue}} # noqa: E501{{/optionalVars}}
"""
{{#vars}}{{#-first}}
{{/-first}}
self._{{name}} = None
{{/vars}}
self.discriminator = {{#discriminator}}'{{{discriminatorName}}}'{{/discriminator}}{{^discriminator}}None{{/discriminator}}
{{#vars}}{{#-first}}
{{/-first}}
{{#required}}
self.{{name}} = {{name}}
{{/required}}
{{^required}}
{{#isNullable}}
self.{{name}} = {{name}}
{{/isNullable}}
{{^isNullable}}
if {{name}} is not None:
self.{{name}} = {{name}} # noqa: E501
{{/isNullable}}
{{/required}}
{{/vars}}
{{#vars}}
@property
def {{name}}(self):
"""Gets the {{name}} of this {{classname}}. # noqa: E501
{{#description}}
{{{description}}} # noqa: E501
{{/description}}
:return: The {{name}} of this {{classname}}. # noqa: E501
:rtype: {{dataType}}
"""
return self._{{name}}
@{{name}}.setter
def {{name}}(
self,
{{name}}):
"""Sets the {{name}} of this {{classname}}.
{{#description}}
{{{description}}} # noqa: E501
{{/description}}
:param {{name}}: The {{name}} of this {{classname}}. # noqa: E501
:type: {{dataType}}
"""
{{^isNullable}}
{{#required}}
if {{name}} is None:
raise ValueError("Invalid value for `{{name}}`, must not be `None`") # noqa: E501
{{/required}}
{{/isNullable}}
{{#isEnum}}
{{#isContainer}}
allowed_values = [{{#isNullable}}None,{{/isNullable}}{{#allowableValues}}{{#values}}{{#items.isString}}"{{/items.isString}}{{{this}}}{{#items.isString}}"{{/items.isString}}{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}] # noqa: E501
{{#isListContainer}}
if not set({{{name}}}).issubset(set(allowed_values)):
raise ValueError(
"Invalid values for `{{{name}}}` [{0}], must be a subset of [{1}]" # noqa: E501
.format(", ".join(map(str, set({{{name}}}) - set(allowed_values))), # noqa: E501
", ".join(map(str, allowed_values)))
)
{{/isListContainer}}
{{#isMapContainer}}
if not set({{{name}}}.keys()).issubset(set(allowed_values)):
raise ValueError(
"Invalid keys in `{{{name}}}` [{0}], must be a subset of [{1}]" # noqa: E501
.format(", ".join(map(str, set({{{name}}}.keys()) - set(allowed_values))), # noqa: E501
", ".join(map(str, allowed_values)))
)
{{/isMapContainer}}
{{/isContainer}}
{{^isContainer}}
allowed_values = [{{#isNullable}}None,{{/isNullable}}{{#allowableValues}}{{#values}}{{#isString}}"{{/isString}}{{{this}}}{{#isString}}"{{/isString}}{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}] # noqa: E501
if {{{name}}} not in allowed_values:
raise ValueError(
"Invalid value for `{{{name}}}` ({0}), must be one of {1}" # noqa: E501
.format({{{name}}}, allowed_values)
)
{{/isContainer}}
{{/isEnum}}
{{^isEnum}}
{{#hasValidation}}
{{#maxLength}}
if {{name}} is not None and len({{name}}) > {{maxLength}}:
raise ValueError("Invalid value for `{{name}}`, length must be less than or equal to `{{maxLength}}`") # noqa: E501
{{/maxLength}}
{{#minLength}}
if {{name}} is not None and len({{name}}) < {{minLength}}:
raise ValueError("Invalid value for `{{name}}`, length must be greater than or equal to `{{minLength}}`") # noqa: E501
{{/minLength}}
{{#maximum}}
if {{name}} is not None and {{name}} >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{maximum}}: # noqa: E501
raise ValueError("Invalid value for `{{name}}`, must be a value less than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}`{{maximum}}`") # noqa: E501
{{/maximum}}
{{#minimum}}
if {{name}} is not None and {{name}} <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{minimum}}: # noqa: E501
raise ValueError("Invalid value for `{{name}}`, must be a value greater than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}`{{minimum}}`") # noqa: E501
{{/minimum}}
{{#pattern}}
if {{name}} is not None and not re.search(r'{{{vendorExtensions.x-regex}}}', {{name}}{{#vendorExtensions.x-modifiers}}{{#-first}}, flags={{/-first}}re.{{.}}{{^-last}} | {{/-last}}{{/vendorExtensions.x-modifiers}}): # noqa: E501
raise ValueError(r"Invalid value for `{{name}}`, must be a follow pattern or equal to `{{{pattern}}}`") # noqa: E501
{{/pattern}}
{{#maxItems}}
if {{name}} is not None and len({{name}}) > {{maxItems}}:
raise ValueError("Invalid value for `{{name}}`, number of items must be less than or equal to `{{maxItems}}`") # noqa: E501
{{/maxItems}}
{{#minItems}}
if {{name}} is not None and len({{name}}) < {{minItems}}:
raise ValueError("Invalid value for `{{name}}`, number of items must be greater than or equal to `{{minItems}}`") # noqa: E501
{{/minItems}}
{{/hasValidation}}
{{/isEnum}}
self._{{name}} = (
{{name}})
{{/vars}}
{{#discriminator}}
def get_real_child_model(self, data):
"""Returns the real base class specified by the discriminator"""
discriminator_key = self.attribute_map[self.discriminator]
discriminator_value = data[discriminator_key]
return self.discriminator_value_class_map.get(discriminator_value)
{{/discriminator}}
def to_dict(self):
"""Returns the model properties as a dict"""
result = {}
for attr, _ in six.iteritems(self.openapi_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict") else item,
value.items()
))
else:
result[attr] = value
return result
def to_str(self):
"""Returns the string representation of the model"""
return pprint.pformat(self.to_dict())
def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str()
def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, {{classname}}):
return False
return self.__dict__ == other.__dict__
def __ne__(self, other):
"""Returns true if both objects are not equal"""
return not self == other
{{/interfaces}}
{{/model}}
{{/models}}

View File

@ -0,0 +1,16 @@
allowed_values = {
{{#vars}}
{{#isEnum}}
('{{name}}',): {
{{#isNullable}}
'None': None,
{{/isNullable}}
{{#allowableValues}}
{{#enumVars}}
'{{name}}': {{{value}}}{{^-last}},{{/-last}}
{{/enumVars}}
{{/allowableValues}}
},
{{/isEnum}}
{{/vars}}
}

View File

@ -0,0 +1,25 @@
openapi_types = {
{{#vars}}
'{{name}}': '{{{dataType}}}'{{#hasMore}},{{/hasMore}}
{{/vars}}
}
validations = {
{{#vars}}
{{#hasValidation}}
('{{name}}',): {
{{#maxLength}}
'max_length': {{maxLength}},{{/maxLength}}{{#minLength}}
'min_length': {{minLength}},{{/minLength}}{{#maxItems}}
'max_items': {{maxItems}},{{/maxItems}}{{#minItems}}
'min_items': {{minItems}},{{/minItems}}{{#maximum}}
{{#exclusiveMaximum}}'exclusive_maximum'{{/exclusiveMaximum}}'inclusive_maximum'{{^exclusiveMaximum}}{{/exclusiveMaximum}}: {{maximum}},{{/maximum}}{{#minimum}}
{{#exclusiveMinimum}}'exclusive_minimum'{{/exclusiveMinimum}}'inclusive_minimum'{{^exclusiveMinimum}}{{/exclusiveMinimum}}: {{minimum}},{{/minimum}}{{#pattern}}
'regex': {
'pattern': r'{{{vendorExtensions.x-regex}}}', # noqa: E501{{#vendorExtensions.x-modifiers}}
{{#-first}}'flags': (re.{{.}}{{/-first}}{{^-first}} re.{{.}}{{/-first}}{{^-last}} | {{/-last}}{{#-last}}){{/-last}}{{/vendorExtensions.x-modifiers}}
},{{/pattern}}
},
{{/hasValidation}}
{{/vars}}
}

View File

@ -0,0 +1,4 @@
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.

View File

@ -0,0 +1,7 @@
openapi_types (dict): The key is attribute name
and the value is attribute type.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.

View File

@ -0,0 +1,76 @@
def __init__(self{{#vars}}, {{name}}={{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}None{{/defaultValue}}{{/vars}}): # noqa: E501
"""{{classname}} - a model defined in OpenAPI""" # noqa: E501
{{#vars}}{{#-first}}
{{/-first}}
self._{{name}} = None
{{/vars}}
self.discriminator = {{#discriminator}}'{{{discriminatorName}}}'{{/discriminator}}{{^discriminator}}None{{/discriminator}}
{{#vars}}{{#-first}}
{{/-first}}
{{#required}}
self.{{name}} = {{name}}
{{/required}}
{{^required}}
{{#isNullable}}
self.{{name}} = {{name}}
{{/isNullable}}
{{^isNullable}}
if {{name}} is not None:
self.{{name}} = (
{{name}}
)
{{/isNullable}}
{{/required}}
{{/vars}}
{{#vars}}
@property
def {{name}}(self):
"""Gets the {{name}} of this {{classname}}. # noqa: E501
{{#description}}
{{{description}}} # noqa: E501
{{/description}}
:return: The {{name}} of this {{classname}}. # noqa: E501
:rtype: {{dataType}}
"""
return self._{{name}}
@{{name}}.setter
def {{name}}(self, {{name}}): # noqa: E501
"""Sets the {{name}} of this {{classname}}.
{{#description}}
{{{description}}} # noqa: E501
{{/description}}
:param {{name}}: The {{name}} of this {{classname}}. # noqa: E501
:type: {{dataType}}
"""
{{^isNullable}}
{{#required}}
if {{name}} is None:
raise ApiValueError("Invalid value for `{{name}}`, must not be `None`") # noqa: E501
{{/required}}
{{/isNullable}}
{{#isEnum}}
check_allowed_values(
self.allowed_values,
('{{name}}',),
{{name}},
self.validations
)
{{/isEnum}}
{{#hasValidation}}
check_validations(
self.validations,
('{{name}}',),
{{name}}
)
{{/hasValidation}}
self._{{name}} = (
{{name}}
)
{{/vars}}

View File

@ -0,0 +1,83 @@
class {{classname}}(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
{{> python-experimental/model_templates/docstring_allowed }}
attribute_map (dict): The key is attribute name
and the value is json key in definition.
discriminator_value_class_map (dict): A dict to go from the discriminator
variable value to the discriminator class name.
{{> python-experimental/model_templates/docstring_openapi_validations }}
"""
{{> python-experimental/model_templates/classvar_allowed }}
attribute_map = {
{{#vars}}
'{{name}}': '{{baseName}}'{{#hasMore}},{{/hasMore}} # noqa: E501
{{/vars}}
}
{{#discriminator}}
discriminator_value_class_map = {
{{#children}}'{{^vendorExtensions.x-discriminator-value}}{{name}}{{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-discriminator-value}}{{{vendorExtensions.x-discriminator-value}}}{{/vendorExtensions.x-discriminator-value}}': '{{{classname}}}'{{^-last}},
{{/-last}}{{/children}}
}
{{/discriminator}}
{{> python-experimental/model_templates/classvar_openapi_validations }}
{{> python-experimental/model_templates/methods_init_properties }}
{{#discriminator}}
def get_real_child_model(self, data):
"""Returns the real base class specified by the discriminator"""
discriminator_key = self.attribute_map[self.discriminator]
discriminator_value = data[discriminator_key]
return self.discriminator_value_class_map.get(discriminator_value)
{{/discriminator}}
def to_dict(self):
"""Returns the model properties as a dict"""
result = {}
for attr, _ in six.iteritems(self.openapi_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict") else item,
value.items()
))
else:
result[attr] = value
return result
def to_str(self):
"""Returns the string representation of the model"""
return pprint.pformat(self.to_dict())
def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str()
def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, {{classname}}):
return False
return self.__dict__ == other.__dict__
def __ne__(self, other):
"""Returns true if both objects are not equal"""
return not self == other

View File

@ -0,0 +1,34 @@
class {{classname}}(ModelSimple):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
{{> python-experimental/model_templates/docstring_allowed }}
{{> python-experimental/model_templates/docstring_openapi_validations }}
"""
{{> python-experimental/model_templates/classvar_allowed }}
{{> python-experimental/model_templates/classvar_openapi_validations }}
{{> python-experimental/model_templates/methods_init_properties }}
def to_str(self):
"""Returns the string representation of the model"""
return str(self._value)
def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str()
def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, {{classname}}):
return False
return self.__dict__ == other.__dict__
def __ne__(self, other):
"""Returns true if both objects are not equal"""
return not self == other

View File

@ -0,0 +1,175 @@
# coding: utf-8
{{>partial_header}}
import re
from {{packageName}}.exceptions import ApiValueError
def check_allowed_values(allowed_values, input_variable_path, input_values,
validations):
"""Raises an exception if the input_values are not allowed
Args:
allowed_values (dict): the allowed_values dict
input_variable_path (tuple): the path to the input variable
input_values (list/str/int/float/date/datetime): the values that we
are checking to see if they are in allowed_values
validations (dict): the validations dict
"""
min_collection_length = (
validations.get(input_variable_path, {}).get('min_length') or
validations.get(input_variable_path, {}).get('min_items', 0))
these_allowed_values = list(allowed_values[input_variable_path].values())
if (isinstance(input_values, list)
and len(input_values) > min_collection_length
and not set(input_values).issubset(
set(these_allowed_values))):
invalid_values = ", ".join(
map(str, set(input_values) - set(these_allowed_values))),
raise ApiValueError(
"Invalid values for `%s` [%s], must be a subset of [%s]" %
(
input_variable_path[0],
invalid_values,
", ".join(map(str, these_allowed_values))
)
)
elif (isinstance(input_values, dict)
and len(input_values) > min_collection_length
and not set(
input_values.keys()).issubset(set(these_allowed_values))):
invalid_values = ", ".join(
map(str, set(input_values.keys()) - set(these_allowed_values)))
raise ApiValueError(
"Invalid keys in `%s` [%s], must be a subset of [%s]" %
(
input_variable_path[0],
invalid_values,
", ".join(map(str, these_allowed_values))
)
)
elif (not isinstance(input_values, (list, dict))
and input_values not in these_allowed_values):
raise ApiValueError(
"Invalid value for `%s` (%s), must be one of %s" %
(
input_variable_path[0],
input_values,
these_allowed_values
)
)
def check_validations(validations, input_variable_path, input_values):
"""Raises an exception if the input_values are invalid
Args:
validations (dict): the validation dictionary
input_variable_path (tuple): the path to the input variable
input_values (list/str/int/float/date/datetime): the values that we
are checking
"""
current_validations = validations[input_variable_path]
if ('max_length' in current_validations and
len(input_values) > current_validations['max_length']):
raise ApiValueError(
"Invalid value for `%s`, length must be less than or equal to "
"`%s`" % (
input_variable_path[0],
current_validations['max_length']
)
)
if ('min_length' in current_validations and
len(input_values) < current_validations['min_length']):
raise ApiValueError(
"Invalid value for `%s`, length must be greater than or equal to "
"`%s`" % (
input_variable_path[0],
current_validations['min_length']
)
)
if ('max_items' in current_validations and
len(input_values) > current_validations['max_items']):
raise ApiValueError(
"Invalid value for `%s`, number of items must be less than or "
"equal to `%s`" % (
input_variable_path[0],
current_validations['max_items']
)
)
if ('min_items' in current_validations and
len(input_values) < current_validations['min_items']):
raise ValueError(
"Invalid value for `%s`, number of items must be greater than or "
"equal to `%s`" % (
input_variable_path[0],
current_validations['min_items']
)
)
if ('exclusive_maximum' in current_validations and
input_values >= current_validations['exclusive_maximum']):
raise ApiValueError(
"Invalid value for `%s`, must be a value less than `%s`" % (
input_variable_path[0],
current_validations['exclusive_maximum']
)
)
if ('inclusive_maximum' in current_validations and
input_values > current_validations['inclusive_maximum']):
raise ApiValueError(
"Invalid value for `%s`, must be a value less than or equal to "
"`%s`" % (
input_variable_path[0],
current_validations['inclusive_maximum']
)
)
if ('exclusive_minimum' in current_validations and
input_values <= current_validations['exclusive_minimum']):
raise ApiValueError(
"Invalid value for `%s`, must be a value greater than `%s`" %
(
input_variable_path[0],
current_validations['exclusive_maximum']
)
)
if ('inclusive_minimum' in current_validations and
input_values < current_validations['inclusive_minimum']):
raise ApiValueError(
"Invalid value for `%s`, must be a value greater than or equal "
"to `%s`" % (
input_variable_path[0],
current_validations['inclusive_minimum']
)
)
flags = current_validations.get('regex', {}).get('flags', 0)
if ('regex' in current_validations and
not re.search(current_validations['regex']['pattern'],
input_values, flags=flags)):
raise ApiValueError(
r"Invalid value for `%s`, must be a follow pattern or equal to "
r"`%s` with flags=`%s`" % (
input_variable_path[0],
current_validations['regex']['pattern'],
flags
)
)
class ModelSimple(object):
# the parent class of models whose type != object in their swagger/openapi
# spec
pass
class ModelNormal(object):
# the parent class of models whose type == object in their swagger/openapi
# spec
pass

View File

@ -906,6 +906,23 @@ paths:
description: Output composite
schema:
$ref: '#/definitions/OuterComposite'
/fake/outer/enum:
post:
tags:
- fake
description: Test serialization of outer enum
operationId: fakeOuterEnumSerialize
parameters:
- name: body
in: body
description: Input enum as post body
schema:
$ref: '#/definitions/OuterEnum'
responses:
'200':
description: Output enum
schema:
$ref: '#/definitions/OuterEnum'
/fake/jsonFormData:
get:
tags:
@ -1378,7 +1395,7 @@ definitions:
minimum: 67.8
string:
type: string
pattern: /[a-z]/i
pattern: /^[a-z]+$/i
byte:
type: string
format: byte
@ -1721,6 +1738,8 @@ definitions:
$ref: '#/definitions/OuterBoolean'
OuterNumber:
type: number
minimum: 10
maximum: 20
OuterString:
type: string
OuterBoolean:

View File

@ -1 +1 @@
4.0.3-SNAPSHOT
4.1.3-SNAPSHOT

View File

@ -14,7 +14,7 @@ Python 2.7 and 3.4+
## Installation & Usage
### pip install
If the python package is hosted on Github, you can install directly from Github
If the python package is hosted on a repository, you can install directly using:
```sh
pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git
@ -77,6 +77,7 @@ Class | Method | HTTP request | Description
*FakeApi* | [**create_xml_item**](docs/FakeApi.md#create_xml_item) | **POST** /fake/create_xml_item | creates an XmlItem
*FakeApi* | [**fake_outer_boolean_serialize**](docs/FakeApi.md#fake_outer_boolean_serialize) | **POST** /fake/outer/boolean |
*FakeApi* | [**fake_outer_composite_serialize**](docs/FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite |
*FakeApi* | [**fake_outer_enum_serialize**](docs/FakeApi.md#fake_outer_enum_serialize) | **POST** /fake/outer/enum |
*FakeApi* | [**fake_outer_number_serialize**](docs/FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number |
*FakeApi* | [**fake_outer_string_serialize**](docs/FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string |
*FakeApi* | [**test_body_with_file_schema**](docs/FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema |
@ -152,9 +153,11 @@ Class | Method | HTTP request | Description
- [Order](docs/Order.md)
- [OuterComposite](docs/OuterComposite.md)
- [OuterEnum](docs/OuterEnum.md)
- [OuterNumber](docs/OuterNumber.md)
- [Pet](docs/Pet.md)
- [ReadOnlyFirst](docs/ReadOnlyFirst.md)
- [SpecialModelName](docs/SpecialModelName.md)
- [StringBooleanMap](docs/StringBooleanMap.md)
- [Tag](docs/Tag.md)
- [TypeHolderDefault](docs/TypeHolderDefault.md)
- [TypeHolderExample](docs/TypeHolderExample.md)

View File

@ -4,7 +4,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**class_name** | **str** | |
**color** | **str** | | [optional] [default to 'red']
**color** | **str** | | [optional] if omitted the server will use the default value of 'red'
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -3,7 +3,9 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**class_name** | **str** | |
**declawed** | **bool** | | [optional]
**color** | **str** | | [optional] if omitted the server will use the default value of 'red'
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -3,8 +3,8 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **str** | | defaults to 'default-name'
**id** | **int** | | [optional]
**name** | **str** | | [default to 'default-name']
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -3,7 +3,9 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**class_name** | **str** | |
**breed** | **str** | | [optional]
**color** | **str** | | [optional] if omitted the server will use the default value of 'red'
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -3,6 +3,7 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**value** | **str** | | defaults to '-efg'
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -3,8 +3,8 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**enum_string** | **str** | | [optional]
**enum_string_required** | **str** | |
**enum_string** | **str** | | [optional]
**enum_integer** | **int** | | [optional]
**enum_number** | **float** | | [optional]
**outer_enum** | [**OuterEnum**](OuterEnum.md) | | [optional]

View File

@ -7,6 +7,7 @@ Method | HTTP request | Description
[**create_xml_item**](FakeApi.md#create_xml_item) | **POST** /fake/create_xml_item | creates an XmlItem
[**fake_outer_boolean_serialize**](FakeApi.md#fake_outer_boolean_serialize) | **POST** /fake/outer/boolean |
[**fake_outer_composite_serialize**](FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite |
[**fake_outer_enum_serialize**](FakeApi.md#fake_outer_enum_serialize) | **POST** /fake/outer/enum |
[**fake_outer_number_serialize**](FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number |
[**fake_outer_string_serialize**](FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string |
[**test_body_with_file_schema**](FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema |
@ -179,8 +180,61 @@ 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)
# **fake_outer_enum_serialize**
> OuterEnum fake_outer_enum_serialize()
Test serialization of outer enum
### Example
```python
from __future__ import print_function
import time
import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
# Create an instance of the API class
api_instance = petstore_api.FakeApi()
body = OuterEnum("placed") # OuterEnum | Input enum as post body (optional)
try:
api_response = api_instance.fake_outer_enum_serialize(body=body)
pprint(api_response)
except ApiException as e:
print("Exception when calling FakeApi->fake_outer_enum_serialize: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**OuterEnum**](str.md)| Input enum as post body | [optional]
### Return type
[**OuterEnum**](OuterEnum.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: */*
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Output enum | - |
[[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)
# **fake_outer_number_serialize**
> float fake_outer_number_serialize()
> OuterNumber fake_outer_number_serialize()
@ -197,7 +251,7 @@ from pprint import pprint
# Create an instance of the API class
api_instance = petstore_api.FakeApi()
body = 3.4 # float | Input number as post body (optional)
body = OuterNumber(3.4) # OuterNumber | Input number as post body (optional)
try:
api_response = api_instance.fake_outer_number_serialize(body=body)
@ -210,11 +264,11 @@ except ApiException as e:
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | **float**| Input number as post body | [optional]
**body** | [**OuterNumber**](float.md)| Input number as post body | [optional]
### Return type
**float**
[**OuterNumber**](OuterNumber.md)
### Authorization

View File

@ -3,19 +3,19 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**number** | **float** | |
**byte** | **str** | |
**date** | **date** | |
**password** | **str** | |
**integer** | **int** | | [optional]
**int32** | **int** | | [optional]
**int64** | **int** | | [optional]
**number** | **float** | |
**float** | **float** | | [optional]
**double** | **float** | | [optional]
**string** | **str** | | [optional]
**byte** | **str** | |
**binary** | **file** | | [optional]
**date** | **date** | |
**date_time** | **datetime** | | [optional]
**uuid** | **str** | | [optional]
**password** | **str** | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -6,7 +6,7 @@ Name | Type | Description | Notes
**map_map_of_string** | **dict(str, dict(str, str))** | | [optional]
**map_of_enum_string** | **dict(str, str)** | | [optional]
**direct_map** | **dict(str, bool)** | | [optional]
**indirect_map** | **dict(str, bool)** | | [optional]
**indirect_map** | [**StringBooleanMap**](StringBooleanMap.md) | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -8,7 +8,7 @@ Name | Type | Description | Notes
**quantity** | **int** | | [optional]
**ship_date** | **datetime** | | [optional]
**status** | **str** | Order Status | [optional]
**complete** | **bool** | | [optional] [default to False]
**complete** | **bool** | | [optional] if omitted the server will use the default value of False
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -3,7 +3,7 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**my_number** | **float** | | [optional]
**my_number** | [**OuterNumber**](OuterNumber.md) | | [optional]
**my_string** | **str** | | [optional]
**my_boolean** | **bool** | | [optional]

View File

@ -3,6 +3,7 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**value** | **str** | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,10 @@
# OuterNumber
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**value** | **float** | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -3,10 +3,10 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **int** | | [optional]
**category** | [**Category**](Category.md) | | [optional]
**name** | **str** | |
**photo_urls** | **list[str]** | |
**id** | **int** | | [optional]
**category** | [**Category**](Category.md) | | [optional]
**tags** | [**list[Tag]**](Tag.md) | | [optional]
**status** | **str** | pet status in the store | [optional]

View File

@ -0,0 +1,9 @@
# StringBooleanMap
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -3,13 +3,13 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**string_item** | **str** | | [default to 'what']
**number_item** | **float** | | [default to 1.234]
**integer_item** | **int** | | [default to -2]
**bool_item** | **bool** | | [default to True]
**array_item** | **list[int]** | |
**string_item** | **str** | | defaults to 'what'
**number_item** | **float** | | defaults to 1.234
**integer_item** | **int** | | defaults to -2
**bool_item** | **bool** | | defaults to True
**date_item** | **date** | | [optional]
**datetime_item** | **datetime** | | [optional]
**array_item** | **list[int]** | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -3,11 +3,11 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**string_item** | **str** | | [default to 'what']
**number_item** | **float** | | [default to 1.234]
**integer_item** | **int** | | [default to -2]
**bool_item** | **bool** | |
**array_item** | **list[int]** | |
**string_item** | **str** | | defaults to 'what'
**number_item** | **float** | | defaults to 1.234
**integer_item** | **int** | | defaults to -2
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,11 +1,17 @@
#!/bin/sh
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
#
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update"
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com"
git_user_id=$1
git_repo_id=$2
release_note=$3
git_host=$4
if [ "$git_host" = "" ]; then
git_host="github.com"
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
fi
if [ "$git_user_id" = "" ]; then
git_user_id="GIT_USER_ID"
@ -28,7 +34,7 @@ git init
# Adds the files in the local repository and stages them for commit.
git add .
# Commits the tracked changes and prepares them to be pushed to a remote repository.
# Commits the tracked changes and prepares them to be pushed to a remote repository.
git commit -m "$release_note"
# Sets the new remote
@ -37,9 +43,9 @@ if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git
fi
fi
@ -47,6 +53,6 @@ fi
git pull origin master
# Pushes (Forces) the changes in the local repository up to the remote repository
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
git push origin master 2>&1 | grep -v 'To https'

View File

@ -1,658 +0,0 @@
# coding: utf-8
"""
OpenAPI Petstore
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import datetime
import inspect
import json
import mimetypes
from multiprocessing.pool import ThreadPool
import os
import re
import tempfile
# python 2 and python 3 compatibility library
import six
from six.moves.urllib.parse import quote
from petstore_api.configuration import Configuration
import petstore_api.models
from petstore_api import rest
from petstore_api.exceptions import ApiValueError
class ApiClient(object):
"""Generic API client for OpenAPI client library builds.
OpenAPI generic API client. This client handles the client-
server communication, and is invariant across implementations. Specifics of
the methods and models for each application are generated from the OpenAPI
templates.
NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
:param configuration: .Configuration object for this client
:param header_name: a header to pass when making calls to the API.
:param header_value: a header value to pass when making calls to
the API.
:param cookie: a cookie to include in the header when making calls
to the API
:param pool_threads: The number of threads to use for async requests
to the API. More threads means more concurrent API requests.
"""
PRIMITIVE_TYPES = (float, bool, bytes, six.text_type) + six.integer_types
NATIVE_TYPES_MAPPING = {
'int': int,
'long': int if six.PY3 else long, # noqa: F821
'float': float,
'str': str,
'bool': bool,
'date': datetime.date,
'datetime': datetime.datetime,
'object': object,
}
_pool = None
def __init__(self, configuration=None, header_name=None, header_value=None,
cookie=None, pool_threads=1):
if configuration is None:
configuration = Configuration()
self.configuration = configuration
self.pool_threads = pool_threads
self.rest_client = rest.RESTClientObject(configuration)
self.default_headers = {}
if header_name is not None:
self.default_headers[header_name] = header_value
self.cookie = cookie
# Set default User-Agent.
self.user_agent = 'OpenAPI-Generator/1.0.0/python'
def __del__(self):
if self._pool:
self._pool.close()
self._pool.join()
self._pool = None
@property
def pool(self):
"""Create thread pool on first request
avoids instantiating unused threadpool for blocking clients.
"""
if self._pool is None:
self._pool = ThreadPool(self.pool_threads)
return self._pool
@property
def user_agent(self):
"""User agent for this API client"""
return self.default_headers['User-Agent']
@user_agent.setter
def user_agent(self, value):
self.default_headers['User-Agent'] = value
def set_default_header(self, header_name, header_value):
self.default_headers[header_name] = header_value
def __call_api(
self, resource_path, method, path_params=None,
query_params=None, header_params=None, body=None, post_params=None,
files=None, response_type=None, auth_settings=None,
_return_http_data_only=None, collection_formats=None,
_preload_content=True, _request_timeout=None, _host=None):
config = self.configuration
# header parameters
header_params = header_params or {}
header_params.update(self.default_headers)
if self.cookie:
header_params['Cookie'] = self.cookie
if header_params:
header_params = self.sanitize_for_serialization(header_params)
header_params = dict(self.parameters_to_tuples(header_params,
collection_formats))
# path parameters
if path_params:
path_params = self.sanitize_for_serialization(path_params)
path_params = self.parameters_to_tuples(path_params,
collection_formats)
for k, v in path_params:
# specified safe chars, encode everything
resource_path = resource_path.replace(
'{%s}' % k,
quote(str(v), safe=config.safe_chars_for_path_param)
)
# query parameters
if query_params:
query_params = self.sanitize_for_serialization(query_params)
query_params = self.parameters_to_tuples(query_params,
collection_formats)
# post parameters
if post_params or files:
post_params = post_params if post_params else []
post_params = self.sanitize_for_serialization(post_params)
post_params = self.parameters_to_tuples(post_params,
collection_formats)
post_params.extend(self.files_parameters(files))
# auth setting
self.update_params_for_auth(header_params, query_params, auth_settings)
# body
if body:
body = self.sanitize_for_serialization(body)
# request url
if _host is None:
url = self.configuration.host + resource_path
else:
# use server/host defined in path or operation instead
url = _host + resource_path
# perform request and return response
response_data = self.request(
method, url, query_params=query_params, headers=header_params,
post_params=post_params, body=body,
_preload_content=_preload_content,
_request_timeout=_request_timeout)
self.last_response = response_data
return_data = response_data
if _preload_content:
# deserialize response data
if response_type:
return_data = self.deserialize(response_data, response_type)
else:
return_data = None
if _return_http_data_only:
return (return_data)
else:
return (return_data, response_data.status,
response_data.getheaders())
def sanitize_for_serialization(self, obj):
"""Builds a JSON POST object.
If obj is None, return None.
If obj is str, int, long, float, bool, return directly.
If obj is datetime.datetime, datetime.date
convert to string in iso8601 format.
If obj is list, sanitize each element in the list.
If obj is dict, return the dict.
If obj is OpenAPI model, return the properties dict.
:param obj: The data to serialize.
:return: The serialized form of data.
"""
if obj is None:
return None
elif isinstance(obj, self.PRIMITIVE_TYPES):
return obj
elif isinstance(obj, list):
return [self.sanitize_for_serialization(sub_obj)
for sub_obj in obj]
elif isinstance(obj, tuple):
return tuple(self.sanitize_for_serialization(sub_obj)
for sub_obj in obj)
elif isinstance(obj, (datetime.datetime, datetime.date)):
return obj.isoformat()
if isinstance(obj, dict):
obj_dict = obj
else:
# Convert model obj to dict except
# attributes `openapi_types`, `attribute_map`
# and attributes which value is not None.
# Convert attribute name to json key in
# model definition for request.
obj_dict = {obj.attribute_map[attr]: getattr(obj, attr)
for attr, _ in six.iteritems(obj.openapi_types)
if getattr(obj, attr) is not None}
return {key: self.sanitize_for_serialization(val)
for key, val in six.iteritems(obj_dict)}
def deserialize(self, response, response_type):
"""Deserializes response into an object.
:param response: RESTResponse object to be deserialized.
:param response_type: class literal for
deserialized object, or string of class name.
:return: deserialized object.
"""
# handle file downloading
# save response body into a tmp file and return the instance
if response_type == "file":
return self.__deserialize_file(response)
# fetch data from response object
try:
data = json.loads(response.data)
except ValueError:
data = response.data
return self.__deserialize(data, response_type)
def __deserialize(self, data, klass):
"""Deserializes dict, list, str into an object.
:param data: dict, list or str.
:param klass: class literal, or string of class name.
:return: object.
"""
if data is None:
return None
if type(klass) == str:
if klass.startswith('list['):
sub_kls = re.match(r'list\[(.*)\]', klass).group(1)
return [self.__deserialize(sub_data, sub_kls)
for sub_data in data]
if klass.startswith('dict('):
sub_kls = re.match(r'dict\(([^,]*), (.*)\)', klass).group(2)
return {k: self.__deserialize(v, sub_kls)
for k, v in six.iteritems(data)}
# convert str to class
if klass in self.NATIVE_TYPES_MAPPING:
klass = self.NATIVE_TYPES_MAPPING[klass]
else:
klass = getattr(petstore_api.models, klass)
if klass in self.PRIMITIVE_TYPES:
return self.__deserialize_primitive(data, klass)
elif klass == object:
return self.__deserialize_object(data)
elif klass == datetime.date:
return self.__deserialize_date(data)
elif klass == datetime.datetime:
return self.__deserialize_datatime(data)
else:
return self.__deserialize_model(data, klass)
def call_api(self, resource_path, method,
path_params=None, query_params=None, header_params=None,
body=None, post_params=None, files=None,
response_type=None, auth_settings=None, async_req=None,
_return_http_data_only=None, collection_formats=None,
_preload_content=True, _request_timeout=None, _host=None):
"""Makes the HTTP request (synchronous) and returns deserialized data.
To make an async_req request, set the async_req parameter.
:param resource_path: Path to method endpoint.
:param method: Method to call.
:param path_params: Path parameters in the url.
:param query_params: Query parameters in the url.
:param header_params: Header parameters to be
placed in the request header.
:param body: Request body.
:param post_params dict: Request post form parameters,
for `application/x-www-form-urlencoded`, `multipart/form-data`.
:param auth_settings list: Auth Settings names for the request.
:param response: Response data type.
:param files dict: key -> filename, value -> filepath,
for `multipart/form-data`.
:param async_req bool: execute request asynchronously
:param _return_http_data_only: response data without head status code
and headers
:param collection_formats: dict of collection formats for path, query,
header, and post parameters.
:param _preload_content: if False, the urllib3.HTTPResponse object will
be returned without reading/decoding response
data. Default is True.
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:return:
If async_req parameter is True,
the request will be called asynchronously.
The method will return the request thread.
If parameter async_req is False or missing,
then the method will return the response directly.
"""
if not async_req:
return self.__call_api(resource_path, method,
path_params, query_params, header_params,
body, post_params, files,
response_type, auth_settings,
_return_http_data_only, collection_formats,
_preload_content, _request_timeout, _host)
else:
thread = self.pool.apply_async(self.__call_api, (resource_path,
method, path_params, query_params,
header_params, body,
post_params, files,
response_type, auth_settings,
_return_http_data_only,
collection_formats,
_preload_content,
_request_timeout,
_host))
return thread
def request(self, method, url, query_params=None, headers=None,
post_params=None, body=None, _preload_content=True,
_request_timeout=None):
"""Makes the HTTP request using RESTClient."""
if method == "GET":
return self.rest_client.GET(url,
query_params=query_params,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
headers=headers)
elif method == "HEAD":
return self.rest_client.HEAD(url,
query_params=query_params,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
headers=headers)
elif method == "OPTIONS":
return self.rest_client.OPTIONS(url,
query_params=query_params,
headers=headers,
post_params=post_params,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
body=body)
elif method == "POST":
return self.rest_client.POST(url,
query_params=query_params,
headers=headers,
post_params=post_params,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
body=body)
elif method == "PUT":
return self.rest_client.PUT(url,
query_params=query_params,
headers=headers,
post_params=post_params,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
body=body)
elif method == "PATCH":
return self.rest_client.PATCH(url,
query_params=query_params,
headers=headers,
post_params=post_params,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
body=body)
elif method == "DELETE":
return self.rest_client.DELETE(url,
query_params=query_params,
headers=headers,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
body=body)
else:
raise ApiValueError(
"http method must be `GET`, `HEAD`, `OPTIONS`,"
" `POST`, `PATCH`, `PUT` or `DELETE`."
)
def parameters_to_tuples(self, params, collection_formats):
"""Get parameters as list of tuples, formatting collections.
:param params: Parameters as dict or list of two-tuples
:param dict collection_formats: Parameter collection formats
:return: Parameters as list of tuples, collections formatted
"""
new_params = []
if collection_formats is None:
collection_formats = {}
for k, v in six.iteritems(params) if isinstance(params, dict) else params: # noqa: E501
if k in collection_formats:
collection_format = collection_formats[k]
if collection_format == 'multi':
new_params.extend((k, value) for value in v)
else:
if collection_format == 'ssv':
delimiter = ' '
elif collection_format == 'tsv':
delimiter = '\t'
elif collection_format == 'pipes':
delimiter = '|'
else: # csv is the default
delimiter = ','
new_params.append(
(k, delimiter.join(str(value) for value in v)))
else:
new_params.append((k, v))
return new_params
def files_parameters(self, files=None):
"""Builds form parameters.
:param files: File parameters.
:return: Form parameters with files.
"""
params = []
if files:
for k, v in six.iteritems(files):
if not v:
continue
file_names = v if type(v) is list else [v]
for n in file_names:
with open(n, 'rb') as f:
filename = os.path.basename(f.name)
filedata = f.read()
mimetype = (mimetypes.guess_type(filename)[0] or
'application/octet-stream')
params.append(
tuple([k, tuple([filename, filedata, mimetype])]))
return params
def select_header_accept(self, accepts):
"""Returns `Accept` based on an array of accepts provided.
:param accepts: List of headers.
:return: Accept (e.g. application/json).
"""
if not accepts:
return
accepts = [x.lower() for x in accepts]
if 'application/json' in accepts:
return 'application/json'
else:
return ', '.join(accepts)
def select_header_content_type(self, content_types):
"""Returns `Content-Type` based on an array of content_types provided.
:param content_types: List of content-types.
:return: Content-Type (e.g. application/json).
"""
if not content_types:
return 'application/json'
content_types = [x.lower() for x in content_types]
if 'application/json' in content_types or '*/*' in content_types:
return 'application/json'
else:
return content_types[0]
def update_params_for_auth(self, headers, querys, auth_settings):
"""Updates header and query params based on authentication setting.
:param headers: Header parameters dict to be updated.
:param querys: Query parameters tuple list to be updated.
:param auth_settings: Authentication setting identifiers list.
"""
if not auth_settings:
return
for auth in auth_settings:
auth_setting = self.configuration.auth_settings().get(auth)
if auth_setting:
if not auth_setting['value']:
continue
elif auth_setting['in'] == 'cookie':
headers['Cookie'] = auth_setting['value']
elif auth_setting['in'] == 'header':
headers[auth_setting['key']] = auth_setting['value']
elif auth_setting['in'] == 'query':
querys.append((auth_setting['key'], auth_setting['value']))
else:
raise ApiValueError(
'Authentication token must be in `query` or `header`'
)
def __deserialize_file(self, response):
"""Deserializes body to file
Saves response body into a file in a temporary folder,
using the filename from the `Content-Disposition` header if provided.
:param response: RESTResponse.
:return: file path.
"""
fd, path = tempfile.mkstemp(dir=self.configuration.temp_folder_path)
os.close(fd)
os.remove(path)
content_disposition = response.getheader("Content-Disposition")
if content_disposition:
filename = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?',
content_disposition).group(1)
path = os.path.join(os.path.dirname(path), filename)
with open(path, "wb") as f:
f.write(response.data)
return path
def __deserialize_primitive(self, data, klass):
"""Deserializes string to primitive type.
:param data: str.
:param klass: class literal.
:return: int, long, float, str, bool.
"""
try:
return klass(data)
except UnicodeEncodeError:
return six.text_type(data)
except TypeError:
return data
def __deserialize_object(self, value):
"""Return an original value.
:return: object.
"""
return value
def __deserialize_date(self, string):
"""Deserializes string to date.
:param string: str.
:return: date.
"""
try:
from dateutil.parser import parse
return parse(string).date()
except ImportError:
return string
except ValueError:
raise rest.ApiException(
status=0,
reason="Failed to parse `{0}` as date object".format(string)
)
def __deserialize_datatime(self, string):
"""Deserializes string to datetime.
The string should be in iso8601 datetime format.
:param string: str.
:return: datetime.
"""
try:
from dateutil.parser import parse
return parse(string)
except ImportError:
return string
except ValueError:
raise rest.ApiException(
status=0,
reason=(
"Failed to parse `{0}` as datetime object"
.format(string)
)
)
def __deserialize_model(self, data, klass):
"""Deserializes list or dict to model.
:param data: dict, list.
:param klass: class literal.
:return: model object.
"""
if not klass.openapi_types and not hasattr(klass,
'get_real_child_model'):
return data
used_data = data
if not isinstance(data, (list, dict)):
used_data = [data]
keyword_args = {}
positional_args = []
if klass.openapi_types is not None:
for attr, attr_type in six.iteritems(klass.openapi_types):
if (data is not None and
klass.attribute_map[attr] in used_data):
value = used_data[klass.attribute_map[attr]]
keyword_args[attr] = self.__deserialize(value, attr_type)
end_index = None
argspec = inspect.getargspec(getattr(klass, '__init__'))
if argspec.defaults:
end_index = -len(argspec.defaults)
required_positional_args = argspec.args[1:end_index]
for index, req_positional_arg in enumerate(required_positional_args):
if keyword_args and req_positional_arg in keyword_args:
positional_args.append(keyword_args[req_positional_arg])
del keyword_args[req_positional_arg]
elif (not keyword_args and index < len(used_data) and
isinstance(used_data, list)):
positional_args.append(used_data[index])
instance = klass(*positional_args, **keyword_args)
if hasattr(instance, 'get_real_child_model'):
klass_name = instance.get_real_child_model(data)
if klass_name:
instance = self.__deserialize(data, klass_name)
return instance

View File

@ -71,9 +71,11 @@ from petstore_api.models.number_only import NumberOnly
from petstore_api.models.order import Order
from petstore_api.models.outer_composite import OuterComposite
from petstore_api.models.outer_enum import OuterEnum
from petstore_api.models.outer_number import OuterNumber
from petstore_api.models.pet import Pet
from petstore_api.models.read_only_first import ReadOnlyFirst
from petstore_api.models.special_model_name import SpecialModelName
from petstore_api.models.string_boolean_map import StringBooleanMap
from petstore_api.models.tag import Tag
from petstore_api.models.type_holder_default import TypeHolderDefault
from petstore_api.models.type_holder_example import TypeHolderExample

View File

@ -18,10 +18,14 @@ import re # noqa: F401
import six
from petstore_api.api_client import ApiClient
from petstore_api.exceptions import ( # noqa: F401
from petstore_api.exceptions import (
ApiTypeError,
ApiValueError
)
from petstore_api.model_utils import (
check_allowed_values,
check_validations
)
class AnotherFakeApi(object):
@ -36,122 +40,269 @@ class AnotherFakeApi(object):
api_client = ApiClient()
self.api_client = api_client
def call_123_test_special_tags(self, body, **kwargs): # noqa: E501
"""To test special tags # noqa: E501
def __call_123_test_special_tags(self, body, **kwargs): # noqa: E501
"""To test special tags # noqa: E501
To test special tags and operation ID starting with number # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.call_123_test_special_tags(body, async_req=True)
>>> result = thread.get()
To test special tags and operation ID starting with number # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.call_123_test_special_tags(body, async_req=True)
>>> result = thread.get()
:param async_req bool: execute request asynchronously
:param Client body: client model (required)
:param _return_http_data_only: response data without head status
code and headers
:param _preload_content: if False, the urllib3.HTTPResponse object
will be returned without reading/decoding response data.
Default is True.
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request timeout. It can also
be a pair (tuple) of (connection, read) timeouts.
:return: Client
If the method is called asynchronously, returns the request
thread.
"""
kwargs['_return_http_data_only'] = kwargs.get(
'_return_http_data_only', True
)
kwargs['body'] = body
return self.call_with_http_info(**kwargs)
self.call_123_test_special_tags = Endpoint(
settings={
'response_type': 'Client',
'auth': [],
'endpoint_path': '/another-fake/dummy',
'operation_id': 'call_123_test_special_tags',
'http_method': 'PATCH',
'servers': [],
},
params_map={
'all': [
'body',
],
'required': [
'body',
],
'nullable': [
],
'enum': [
],
'validation': [
]
},
root_map={
'validations': {
},
'allowed_values': {
},
'openapi_types': {
'body': 'Client',
},
'attribute_map': {
},
'location_map': {
'body': 'body',
},
'collection_format_map': {
}
},
headers_map={
'accept': [
'application/json'
],
'content_type': [
'application/json'
]
},
api_client=api_client,
callable=__call_123_test_special_tags
)
class Endpoint(object):
def __init__(self, settings=None, params_map=None, root_map=None,
headers_map=None, api_client=None, callable=None):
"""Creates an endpoint
Args:
body (Client): client model
Keyword Args:
async_req (bool): execute request asynchronously
param _preload_content (bool): if False, the urllib3.HTTPResponse
object will be returned without reading/decoding response data.
Default is True.
param _request_timeout (float/tuple): timeout setting for this
request. If one number provided, it will be total request
timeout. It can also be a pair (tuple) of (connection, read)
timeouts.
Returns:
Client:
settings (dict): see below key value pairs
'response_type' (str): response type
'auth' (list): a list of auth type keys
'endpoint_path' (str): the endpoint path
'operation_id' (str): endpoint string identifier
'http_method' (str): POST/PUT/PATCH/GET etc
'servers' (list): list of str servers that this endpoint is at
params_map (dict): see below key value pairs
'all' (list): list of str endpoint parameter names
'required' (list): list of required parameter names
'nullable' (list): list of nullable parameter names
'enum' (list): list of parameters with enum values
'validation' (list): list of parameters with validations
root_map
'validations' (dict): the dict mapping endpoint parameter tuple
paths to their validation dictionaries
'allowed_values' (dict): the dict mapping endpoint parameter
tuple paths to their allowed_values (enum) dictionaries
'openapi_types' (dict): param_name to openapi type
'attribute_map' (dict): param_name to camelCase name
'location_map' (dict): param_name to 'body', 'file', 'form',
'header', 'path', 'query'
collection_format_map (dict): param_name to `csv` etc.
headers_map (dict): see below key value pairs
'accept' (list): list of Accept header strings
'content_type' (list): list of Content-Type header strings
api_client (ApiClient) api client instance
callable (function): the function which is invoked when the
Endpoint is called
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.call_123_test_special_tags_with_http_info(body, **kwargs) # noqa: E501
else:
(data) = self.call_123_test_special_tags_with_http_info(body, **kwargs) # noqa: E501
return data
self.settings = settings
self.params_map = params_map
self.params_map['all'].extend([
'async_req',
'_host_index',
'_preload_content',
'_request_timeout',
'_return_http_data_only'
])
self.validations = root_map['validations']
self.allowed_values = root_map['allowed_values']
self.openapi_types = root_map['openapi_types']
self.attribute_map = root_map['attribute_map']
self.location_map = root_map['location_map']
self.collection_format_map = root_map['collection_format_map']
self.headers_map = headers_map
self.api_client = api_client
self.callable = callable
def call_123_test_special_tags_with_http_info(self, body, **kwargs): # noqa: E501
"""To test special tags # noqa: E501
To test special tags and operation ID starting with number # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.call_123_test_special_tags_with_http_info(body, async_req=True)
>>> result = thread.get()
Args:
body (Client): client model
Keyword Args:
async_req (bool): execute request asynchronously
param _preload_content (bool): if False, the urllib3.HTTPResponse
object will be returned without reading/decoding response data.
Default is True.
param _request_timeout (float/tuple): timeout setting for this
request. If one number provided, it will be total request
timeout. It can also be a pair (tuple) of (connection, read)
timeouts.
Returns:
Client:
"""
local_var_params = locals()
all_params = ['body'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
for key, val in six.iteritems(local_var_params['kwargs']):
if key not in all_params:
raise ApiTypeError(
"Got an unexpected keyword argument '%s'"
" to method call_123_test_special_tags" % key
def __validate_inputs(self, kwargs):
for param in self.params_map['enum']:
if param in kwargs:
check_allowed_values(
self.allowed_values,
(param,),
kwargs[param],
self.validations
)
local_var_params[key] = val
del local_var_params['kwargs']
# verify the required parameter 'body' is set
if ('body' not in local_var_params or
local_var_params['body'] is None):
raise ApiValueError("Missing the required parameter `body` when calling `call_123_test_special_tags`") # noqa: E501
collection_formats = {}
for param in self.params_map['validation']:
if param in kwargs:
check_validations(
self.validations,
(param,),
kwargs[param]
)
path_params = {}
def __gather_params(self, kwargs):
params = {
'body': None,
'collection_format': {},
'file': {},
'form': [],
'header': {},
'path': {},
'query': []
}
query_params = []
for param_name, param_value in six.iteritems(kwargs):
param_location = self.location_map.get(param_name)
if param_location:
if param_location == 'body':
params['body'] = param_value
continue
base_name = self.attribute_map[param_name]
if (param_location == 'form' and
self.openapi_types[param_name] == 'file'):
param_location = 'file'
elif param_location in {'form', 'query'}:
param_value_full = (base_name, param_value)
params[param_location].append(param_value_full)
if param_location not in {'form', 'query'}:
params[param_location][base_name] = param_value
collection_format = self.collection_format_map.get(param_name)
if collection_format:
params['collection_format'][base_name] = collection_format
header_params = {}
return params
form_params = []
local_var_files = {}
def __call__(self, *args, **kwargs):
""" This method is invoked when endpoints are called
Example:
pet_api = PetApi()
pet_api.add_pet # this is an instance of the class Endpoint
pet_api.add_pet() # this invokes pet_api.add_pet.__call__()
which then invokes the callable functions stored in that endpoint at
pet_api.add_pet.callable or self.callable in this class
"""
return self.callable(self, *args, **kwargs)
body_params = None
if 'body' in local_var_params:
body_params = local_var_params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501
def call_with_http_info(self, **kwargs):
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
if kwargs.get('_host_index') and self.settings['servers']:
_host_index = kwargs.get('_host_index')
try:
_host = self.settings['servers'][_host_index]
except IndexError:
raise ApiValueError(
"Invalid host index. Must be 0 <= index < %s" %
len(self.settings['servers'])
)
else:
try:
_host = self.settings['servers'][0]
except IndexError:
_host = None
# Authentication setting
auth_settings = [] # noqa: E501
for key, value in six.iteritems(kwargs):
if key not in self.params_map['all']:
raise ApiTypeError(
"Got an unexpected parameter '%s'"
" to method `%s`" %
(key, self.settings['operation_id'])
)
if key not in self.params_map['nullable'] and value is None:
raise ApiValueError(
"Value may not be None for non-nullable parameter `%s`"
" when calling `%s`" %
(key, self.settings['operation_id'])
)
for key in self.params_map['required']:
if key not in kwargs.keys():
raise ApiValueError(
"Missing the required parameter `%s` when calling "
"`%s`" % (key, self.settings['operation_id'])
)
self.__validate_inputs(kwargs)
params = self.__gather_params(kwargs)
accept_headers_list = self.headers_map['accept']
if accept_headers_list:
params['header']['Accept'] = self.api_client.select_header_accept(
accept_headers_list)
content_type_headers_list = self.headers_map['content_type']
if content_type_headers_list:
header_list = self.api_client.select_header_content_type(
content_type_headers_list)
params['header']['Content-Type'] = header_list
return self.api_client.call_api(
'/another-fake/dummy', 'PATCH',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='Client', # noqa: E501
auth_settings=auth_settings,
async_req=local_var_params.get('async_req'),
_return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
_preload_content=local_var_params.get('_preload_content', True),
_request_timeout=local_var_params.get('_request_timeout'),
collection_formats=collection_formats)
self.settings['endpoint_path'], self.settings['http_method'],
params['path'],
params['query'],
params['header'],
body=params['body'],
post_params=params['form'],
files=params['file'],
response_type=self.settings['response_type'],
auth_settings=self.settings['auth'],
async_req=kwargs.get('async_req'),
_return_http_data_only=kwargs.get('_return_http_data_only'),
_preload_content=kwargs.get('_preload_content', True),
_request_timeout=kwargs.get('_request_timeout'),
_host=_host,
collection_formats=params['collection_format'])

View File

@ -18,10 +18,14 @@ import re # noqa: F401
import six
from petstore_api.api_client import ApiClient
from petstore_api.exceptions import ( # noqa: F401
from petstore_api.exceptions import (
ApiTypeError,
ApiValueError
)
from petstore_api.model_utils import (
check_allowed_values,
check_validations
)
class FakeClassnameTags123Api(object):
@ -36,122 +40,271 @@ class FakeClassnameTags123Api(object):
api_client = ApiClient()
self.api_client = api_client
def test_classname(self, body, **kwargs): # noqa: E501
"""To test class name in snake case # noqa: E501
def __test_classname(self, body, **kwargs): # noqa: E501
"""To test class name in snake case # noqa: E501
To test class name in snake case # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.test_classname(body, async_req=True)
>>> result = thread.get()
To test class name in snake case # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.test_classname(body, async_req=True)
>>> result = thread.get()
:param async_req bool: execute request asynchronously
:param Client body: client model (required)
:param _return_http_data_only: response data without head status
code and headers
:param _preload_content: if False, the urllib3.HTTPResponse object
will be returned without reading/decoding response data.
Default is True.
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request timeout. It can also
be a pair (tuple) of (connection, read) timeouts.
:return: Client
If the method is called asynchronously, returns the request
thread.
"""
kwargs['_return_http_data_only'] = kwargs.get(
'_return_http_data_only', True
)
kwargs['body'] = body
return self.call_with_http_info(**kwargs)
self.test_classname = Endpoint(
settings={
'response_type': 'Client',
'auth': [
'api_key_query'
],
'endpoint_path': '/fake_classname_test',
'operation_id': 'test_classname',
'http_method': 'PATCH',
'servers': [],
},
params_map={
'all': [
'body',
],
'required': [
'body',
],
'nullable': [
],
'enum': [
],
'validation': [
]
},
root_map={
'validations': {
},
'allowed_values': {
},
'openapi_types': {
'body': 'Client',
},
'attribute_map': {
},
'location_map': {
'body': 'body',
},
'collection_format_map': {
}
},
headers_map={
'accept': [
'application/json'
],
'content_type': [
'application/json'
]
},
api_client=api_client,
callable=__test_classname
)
class Endpoint(object):
def __init__(self, settings=None, params_map=None, root_map=None,
headers_map=None, api_client=None, callable=None):
"""Creates an endpoint
Args:
body (Client): client model
Keyword Args:
async_req (bool): execute request asynchronously
param _preload_content (bool): if False, the urllib3.HTTPResponse
object will be returned without reading/decoding response data.
Default is True.
param _request_timeout (float/tuple): timeout setting for this
request. If one number provided, it will be total request
timeout. It can also be a pair (tuple) of (connection, read)
timeouts.
Returns:
Client:
settings (dict): see below key value pairs
'response_type' (str): response type
'auth' (list): a list of auth type keys
'endpoint_path' (str): the endpoint path
'operation_id' (str): endpoint string identifier
'http_method' (str): POST/PUT/PATCH/GET etc
'servers' (list): list of str servers that this endpoint is at
params_map (dict): see below key value pairs
'all' (list): list of str endpoint parameter names
'required' (list): list of required parameter names
'nullable' (list): list of nullable parameter names
'enum' (list): list of parameters with enum values
'validation' (list): list of parameters with validations
root_map
'validations' (dict): the dict mapping endpoint parameter tuple
paths to their validation dictionaries
'allowed_values' (dict): the dict mapping endpoint parameter
tuple paths to their allowed_values (enum) dictionaries
'openapi_types' (dict): param_name to openapi type
'attribute_map' (dict): param_name to camelCase name
'location_map' (dict): param_name to 'body', 'file', 'form',
'header', 'path', 'query'
collection_format_map (dict): param_name to `csv` etc.
headers_map (dict): see below key value pairs
'accept' (list): list of Accept header strings
'content_type' (list): list of Content-Type header strings
api_client (ApiClient) api client instance
callable (function): the function which is invoked when the
Endpoint is called
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.test_classname_with_http_info(body, **kwargs) # noqa: E501
else:
(data) = self.test_classname_with_http_info(body, **kwargs) # noqa: E501
return data
self.settings = settings
self.params_map = params_map
self.params_map['all'].extend([
'async_req',
'_host_index',
'_preload_content',
'_request_timeout',
'_return_http_data_only'
])
self.validations = root_map['validations']
self.allowed_values = root_map['allowed_values']
self.openapi_types = root_map['openapi_types']
self.attribute_map = root_map['attribute_map']
self.location_map = root_map['location_map']
self.collection_format_map = root_map['collection_format_map']
self.headers_map = headers_map
self.api_client = api_client
self.callable = callable
def test_classname_with_http_info(self, body, **kwargs): # noqa: E501
"""To test class name in snake case # noqa: E501
To test class name in snake case # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.test_classname_with_http_info(body, async_req=True)
>>> result = thread.get()
Args:
body (Client): client model
Keyword Args:
async_req (bool): execute request asynchronously
param _preload_content (bool): if False, the urllib3.HTTPResponse
object will be returned without reading/decoding response data.
Default is True.
param _request_timeout (float/tuple): timeout setting for this
request. If one number provided, it will be total request
timeout. It can also be a pair (tuple) of (connection, read)
timeouts.
Returns:
Client:
"""
local_var_params = locals()
all_params = ['body'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
for key, val in six.iteritems(local_var_params['kwargs']):
if key not in all_params:
raise ApiTypeError(
"Got an unexpected keyword argument '%s'"
" to method test_classname" % key
def __validate_inputs(self, kwargs):
for param in self.params_map['enum']:
if param in kwargs:
check_allowed_values(
self.allowed_values,
(param,),
kwargs[param],
self.validations
)
local_var_params[key] = val
del local_var_params['kwargs']
# verify the required parameter 'body' is set
if ('body' not in local_var_params or
local_var_params['body'] is None):
raise ApiValueError("Missing the required parameter `body` when calling `test_classname`") # noqa: E501
collection_formats = {}
for param in self.params_map['validation']:
if param in kwargs:
check_validations(
self.validations,
(param,),
kwargs[param]
)
path_params = {}
def __gather_params(self, kwargs):
params = {
'body': None,
'collection_format': {},
'file': {},
'form': [],
'header': {},
'path': {},
'query': []
}
query_params = []
for param_name, param_value in six.iteritems(kwargs):
param_location = self.location_map.get(param_name)
if param_location:
if param_location == 'body':
params['body'] = param_value
continue
base_name = self.attribute_map[param_name]
if (param_location == 'form' and
self.openapi_types[param_name] == 'file'):
param_location = 'file'
elif param_location in {'form', 'query'}:
param_value_full = (base_name, param_value)
params[param_location].append(param_value_full)
if param_location not in {'form', 'query'}:
params[param_location][base_name] = param_value
collection_format = self.collection_format_map.get(param_name)
if collection_format:
params['collection_format'][base_name] = collection_format
header_params = {}
return params
form_params = []
local_var_files = {}
def __call__(self, *args, **kwargs):
""" This method is invoked when endpoints are called
Example:
pet_api = PetApi()
pet_api.add_pet # this is an instance of the class Endpoint
pet_api.add_pet() # this invokes pet_api.add_pet.__call__()
which then invokes the callable functions stored in that endpoint at
pet_api.add_pet.callable or self.callable in this class
"""
return self.callable(self, *args, **kwargs)
body_params = None
if 'body' in local_var_params:
body_params = local_var_params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501
def call_with_http_info(self, **kwargs):
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
if kwargs.get('_host_index') and self.settings['servers']:
_host_index = kwargs.get('_host_index')
try:
_host = self.settings['servers'][_host_index]
except IndexError:
raise ApiValueError(
"Invalid host index. Must be 0 <= index < %s" %
len(self.settings['servers'])
)
else:
try:
_host = self.settings['servers'][0]
except IndexError:
_host = None
# Authentication setting
auth_settings = ['api_key_query'] # noqa: E501
for key, value in six.iteritems(kwargs):
if key not in self.params_map['all']:
raise ApiTypeError(
"Got an unexpected parameter '%s'"
" to method `%s`" %
(key, self.settings['operation_id'])
)
if key not in self.params_map['nullable'] and value is None:
raise ApiValueError(
"Value may not be None for non-nullable parameter `%s`"
" when calling `%s`" %
(key, self.settings['operation_id'])
)
for key in self.params_map['required']:
if key not in kwargs.keys():
raise ApiValueError(
"Missing the required parameter `%s` when calling "
"`%s`" % (key, self.settings['operation_id'])
)
self.__validate_inputs(kwargs)
params = self.__gather_params(kwargs)
accept_headers_list = self.headers_map['accept']
if accept_headers_list:
params['header']['Accept'] = self.api_client.select_header_accept(
accept_headers_list)
content_type_headers_list = self.headers_map['content_type']
if content_type_headers_list:
header_list = self.api_client.select_header_content_type(
content_type_headers_list)
params['header']['Content-Type'] = header_list
return self.api_client.call_api(
'/fake_classname_test', 'PATCH',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='Client', # noqa: E501
auth_settings=auth_settings,
async_req=local_var_params.get('async_req'),
_return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
_preload_content=local_var_params.get('_preload_content', True),
_request_timeout=local_var_params.get('_request_timeout'),
collection_formats=collection_formats)
self.settings['endpoint_path'], self.settings['http_method'],
params['path'],
params['query'],
params['header'],
body=params['body'],
post_params=params['form'],
files=params['file'],
response_type=self.settings['response_type'],
auth_settings=self.settings['auth'],
async_req=kwargs.get('async_req'),
_return_http_data_only=kwargs.get('_return_http_data_only'),
_preload_content=kwargs.get('_preload_content', True),
_request_timeout=kwargs.get('_request_timeout'),
_host=_host,
collection_formats=params['collection_format'])

View File

@ -18,10 +18,14 @@ import re # noqa: F401
import six
from petstore_api.api_client import ApiClient
from petstore_api.exceptions import ( # noqa: F401
from petstore_api.exceptions import (
ApiTypeError,
ApiValueError
)
from petstore_api.model_utils import (
check_allowed_values,
check_validations
)
class StoreApi(object):
@ -36,456 +40,503 @@ class StoreApi(object):
api_client = ApiClient()
self.api_client = api_client
def delete_order(self, order_id, **kwargs): # noqa: E501
"""Delete purchase order by ID # noqa: E501
def __delete_order(self, order_id, **kwargs): # noqa: E501
"""Delete purchase order by ID # noqa: E501
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_order(order_id, async_req=True)
>>> result = thread.get()
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_order(order_id, async_req=True)
>>> result = thread.get()
:param async_req bool: execute request asynchronously
:param str order_id: ID of the order that needs to be deleted (required)
:param _return_http_data_only: response data without head status
code and headers
:param _preload_content: if False, the urllib3.HTTPResponse object
will be returned without reading/decoding response data.
Default is True.
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request timeout. It can also
be a pair (tuple) of (connection, read) timeouts.
:return: None
If the method is called asynchronously, returns the request
thread.
"""
kwargs['_return_http_data_only'] = kwargs.get(
'_return_http_data_only', True
)
kwargs['order_id'] = order_id
return self.call_with_http_info(**kwargs)
self.delete_order = Endpoint(
settings={
'response_type': None,
'auth': [],
'endpoint_path': '/store/order/{order_id}',
'operation_id': 'delete_order',
'http_method': 'DELETE',
'servers': [],
},
params_map={
'all': [
'order_id',
],
'required': [
'order_id',
],
'nullable': [
],
'enum': [
],
'validation': [
]
},
root_map={
'validations': {
},
'allowed_values': {
},
'openapi_types': {
'order_id': 'str',
},
'attribute_map': {
'order_id': 'order_id',
},
'location_map': {
'order_id': 'path',
},
'collection_format_map': {
}
},
headers_map={
'accept': [],
'content_type': [],
},
api_client=api_client,
callable=__delete_order
)
def __get_inventory(self, **kwargs): # noqa: E501
"""Returns pet inventories by status # noqa: E501
Returns a map of status codes to quantities # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_inventory(async_req=True)
>>> result = thread.get()
:param async_req bool: execute request asynchronously
:param _return_http_data_only: response data without head status
code and headers
:param _preload_content: if False, the urllib3.HTTPResponse object
will be returned without reading/decoding response data.
Default is True.
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request timeout. It can also
be a pair (tuple) of (connection, read) timeouts.
:return: dict(str, int)
If the method is called asynchronously, returns the request
thread.
"""
kwargs['_return_http_data_only'] = kwargs.get(
'_return_http_data_only', True
)
return self.call_with_http_info(**kwargs)
self.get_inventory = Endpoint(
settings={
'response_type': 'dict(str, int)',
'auth': [
'api_key'
],
'endpoint_path': '/store/inventory',
'operation_id': 'get_inventory',
'http_method': 'GET',
'servers': [],
},
params_map={
'all': [
],
'required': [],
'nullable': [
],
'enum': [
],
'validation': [
]
},
root_map={
'validations': {
},
'allowed_values': {
},
'openapi_types': {
},
'attribute_map': {
},
'location_map': {
},
'collection_format_map': {
}
},
headers_map={
'accept': [
'application/json'
],
'content_type': [],
},
api_client=api_client,
callable=__get_inventory
)
def __get_order_by_id(self, order_id, **kwargs): # noqa: E501
"""Find purchase order by ID # noqa: E501
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_order_by_id(order_id, async_req=True)
>>> result = thread.get()
:param async_req bool: execute request asynchronously
:param int order_id: ID of pet that needs to be fetched (required)
:param _return_http_data_only: response data without head status
code and headers
:param _preload_content: if False, the urllib3.HTTPResponse object
will be returned without reading/decoding response data.
Default is True.
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request timeout. It can also
be a pair (tuple) of (connection, read) timeouts.
:return: Order
If the method is called asynchronously, returns the request
thread.
"""
kwargs['_return_http_data_only'] = kwargs.get(
'_return_http_data_only', True
)
kwargs['order_id'] = order_id
return self.call_with_http_info(**kwargs)
self.get_order_by_id = Endpoint(
settings={
'response_type': 'Order',
'auth': [],
'endpoint_path': '/store/order/{order_id}',
'operation_id': 'get_order_by_id',
'http_method': 'GET',
'servers': [],
},
params_map={
'all': [
'order_id',
],
'required': [
'order_id',
],
'nullable': [
],
'enum': [
],
'validation': [
'order_id',
]
},
root_map={
'validations': {
('order_id',): {
'inclusive_maximum': 5,
'inclusive_minimum': 1,
},
},
'allowed_values': {
},
'openapi_types': {
'order_id': 'int',
},
'attribute_map': {
'order_id': 'order_id',
},
'location_map': {
'order_id': 'path',
},
'collection_format_map': {
}
},
headers_map={
'accept': [
'application/xml',
'application/json'
],
'content_type': [],
},
api_client=api_client,
callable=__get_order_by_id
)
def __place_order(self, body, **kwargs): # noqa: E501
"""Place an order for a pet # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.place_order(body, async_req=True)
>>> result = thread.get()
:param async_req bool: execute request asynchronously
:param Order body: order placed for purchasing the pet (required)
:param _return_http_data_only: response data without head status
code and headers
:param _preload_content: if False, the urllib3.HTTPResponse object
will be returned without reading/decoding response data.
Default is True.
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request timeout. It can also
be a pair (tuple) of (connection, read) timeouts.
:return: Order
If the method is called asynchronously, returns the request
thread.
"""
kwargs['_return_http_data_only'] = kwargs.get(
'_return_http_data_only', True
)
kwargs['body'] = body
return self.call_with_http_info(**kwargs)
self.place_order = Endpoint(
settings={
'response_type': 'Order',
'auth': [],
'endpoint_path': '/store/order',
'operation_id': 'place_order',
'http_method': 'POST',
'servers': [],
},
params_map={
'all': [
'body',
],
'required': [
'body',
],
'nullable': [
],
'enum': [
],
'validation': [
]
},
root_map={
'validations': {
},
'allowed_values': {
},
'openapi_types': {
'body': 'Order',
},
'attribute_map': {
},
'location_map': {
'body': 'body',
},
'collection_format_map': {
}
},
headers_map={
'accept': [
'application/xml',
'application/json'
],
'content_type': [],
},
api_client=api_client,
callable=__place_order
)
class Endpoint(object):
def __init__(self, settings=None, params_map=None, root_map=None,
headers_map=None, api_client=None, callable=None):
"""Creates an endpoint
Args:
order_id (str): ID of the order that needs to be deleted
Keyword Args:
async_req (bool): execute request asynchronously
param _preload_content (bool): if False, the urllib3.HTTPResponse
object will be returned without reading/decoding response data.
Default is True.
param _request_timeout (float/tuple): timeout setting for this
request. If one number provided, it will be total request
timeout. It can also be a pair (tuple) of (connection, read)
timeouts.
Returns:
None:
settings (dict): see below key value pairs
'response_type' (str): response type
'auth' (list): a list of auth type keys
'endpoint_path' (str): the endpoint path
'operation_id' (str): endpoint string identifier
'http_method' (str): POST/PUT/PATCH/GET etc
'servers' (list): list of str servers that this endpoint is at
params_map (dict): see below key value pairs
'all' (list): list of str endpoint parameter names
'required' (list): list of required parameter names
'nullable' (list): list of nullable parameter names
'enum' (list): list of parameters with enum values
'validation' (list): list of parameters with validations
root_map
'validations' (dict): the dict mapping endpoint parameter tuple
paths to their validation dictionaries
'allowed_values' (dict): the dict mapping endpoint parameter
tuple paths to their allowed_values (enum) dictionaries
'openapi_types' (dict): param_name to openapi type
'attribute_map' (dict): param_name to camelCase name
'location_map' (dict): param_name to 'body', 'file', 'form',
'header', 'path', 'query'
collection_format_map (dict): param_name to `csv` etc.
headers_map (dict): see below key value pairs
'accept' (list): list of Accept header strings
'content_type' (list): list of Content-Type header strings
api_client (ApiClient) api client instance
callable (function): the function which is invoked when the
Endpoint is called
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.delete_order_with_http_info(order_id, **kwargs) # noqa: E501
else:
(data) = self.delete_order_with_http_info(order_id, **kwargs) # noqa: E501
return data
self.settings = settings
self.params_map = params_map
self.params_map['all'].extend([
'async_req',
'_host_index',
'_preload_content',
'_request_timeout',
'_return_http_data_only'
])
self.validations = root_map['validations']
self.allowed_values = root_map['allowed_values']
self.openapi_types = root_map['openapi_types']
self.attribute_map = root_map['attribute_map']
self.location_map = root_map['location_map']
self.collection_format_map = root_map['collection_format_map']
self.headers_map = headers_map
self.api_client = api_client
self.callable = callable
def delete_order_with_http_info(self, order_id, **kwargs): # noqa: E501
"""Delete purchase order by ID # noqa: E501
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_order_with_http_info(order_id, async_req=True)
>>> result = thread.get()
Args:
order_id (str): ID of the order that needs to be deleted
Keyword Args:
async_req (bool): execute request asynchronously
param _preload_content (bool): if False, the urllib3.HTTPResponse
object will be returned without reading/decoding response data.
Default is True.
param _request_timeout (float/tuple): timeout setting for this
request. If one number provided, it will be total request
timeout. It can also be a pair (tuple) of (connection, read)
timeouts.
Returns:
None:
"""
local_var_params = locals()
all_params = ['order_id'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
for key, val in six.iteritems(local_var_params['kwargs']):
if key not in all_params:
raise ApiTypeError(
"Got an unexpected keyword argument '%s'"
" to method delete_order" % key
def __validate_inputs(self, kwargs):
for param in self.params_map['enum']:
if param in kwargs:
check_allowed_values(
self.allowed_values,
(param,),
kwargs[param],
self.validations
)
local_var_params[key] = val
del local_var_params['kwargs']
# verify the required parameter 'order_id' is set
if ('order_id' not in local_var_params or
local_var_params['order_id'] is None):
raise ApiValueError("Missing the required parameter `order_id` when calling `delete_order`") # noqa: E501
collection_formats = {}
for param in self.params_map['validation']:
if param in kwargs:
check_validations(
self.validations,
(param,),
kwargs[param]
)
path_params = {}
if 'order_id' in local_var_params:
path_params['order_id'] = local_var_params['order_id'] # noqa: E501
def __gather_params(self, kwargs):
params = {
'body': None,
'collection_format': {},
'file': {},
'form': [],
'header': {},
'path': {},
'query': []
}
query_params = []
for param_name, param_value in six.iteritems(kwargs):
param_location = self.location_map.get(param_name)
if param_location:
if param_location == 'body':
params['body'] = param_value
continue
base_name = self.attribute_map[param_name]
if (param_location == 'form' and
self.openapi_types[param_name] == 'file'):
param_location = 'file'
elif param_location in {'form', 'query'}:
param_value_full = (base_name, param_value)
params[param_location].append(param_value_full)
if param_location not in {'form', 'query'}:
params[param_location][base_name] = param_value
collection_format = self.collection_format_map.get(param_name)
if collection_format:
params['collection_format'][base_name] = collection_format
header_params = {}
return params
form_params = []
local_var_files = {}
def __call__(self, *args, **kwargs):
""" This method is invoked when endpoints are called
Example:
pet_api = PetApi()
pet_api.add_pet # this is an instance of the class Endpoint
pet_api.add_pet() # this invokes pet_api.add_pet.__call__()
which then invokes the callable functions stored in that endpoint at
pet_api.add_pet.callable or self.callable in this class
"""
return self.callable(self, *args, **kwargs)
body_params = None
# Authentication setting
auth_settings = [] # noqa: E501
def call_with_http_info(self, **kwargs):
if kwargs.get('_host_index') and self.settings['servers']:
_host_index = kwargs.get('_host_index')
try:
_host = self.settings['servers'][_host_index]
except IndexError:
raise ApiValueError(
"Invalid host index. Must be 0 <= index < %s" %
len(self.settings['servers'])
)
else:
try:
_host = self.settings['servers'][0]
except IndexError:
_host = None
for key, value in six.iteritems(kwargs):
if key not in self.params_map['all']:
raise ApiTypeError(
"Got an unexpected parameter '%s'"
" to method `%s`" %
(key, self.settings['operation_id'])
)
if key not in self.params_map['nullable'] and value is None:
raise ApiValueError(
"Value may not be None for non-nullable parameter `%s`"
" when calling `%s`" %
(key, self.settings['operation_id'])
)
for key in self.params_map['required']:
if key not in kwargs.keys():
raise ApiValueError(
"Missing the required parameter `%s` when calling "
"`%s`" % (key, self.settings['operation_id'])
)
self.__validate_inputs(kwargs)
params = self.__gather_params(kwargs)
accept_headers_list = self.headers_map['accept']
if accept_headers_list:
params['header']['Accept'] = self.api_client.select_header_accept(
accept_headers_list)
content_type_headers_list = self.headers_map['content_type']
if content_type_headers_list:
header_list = self.api_client.select_header_content_type(
content_type_headers_list)
params['header']['Content-Type'] = header_list
return self.api_client.call_api(
'/store/order/{order_id}', 'DELETE',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=None, # noqa: E501
auth_settings=auth_settings,
async_req=local_var_params.get('async_req'),
_return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
_preload_content=local_var_params.get('_preload_content', True),
_request_timeout=local_var_params.get('_request_timeout'),
collection_formats=collection_formats)
def get_inventory(self, **kwargs): # noqa: E501
"""Returns pet inventories by status # noqa: E501
Returns a map of status codes to quantities # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_inventory(async_req=True)
>>> result = thread.get()
Keyword Args:
async_req (bool): execute request asynchronously
param _preload_content (bool): if False, the urllib3.HTTPResponse
object will be returned without reading/decoding response data.
Default is True.
param _request_timeout (float/tuple): timeout setting for this
request. If one number provided, it will be total request
timeout. It can also be a pair (tuple) of (connection, read)
timeouts.
Returns:
dict(str, int):
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.get_inventory_with_http_info(**kwargs) # noqa: E501
else:
(data) = self.get_inventory_with_http_info(**kwargs) # noqa: E501
return data
def get_inventory_with_http_info(self, **kwargs): # noqa: E501
"""Returns pet inventories by status # noqa: E501
Returns a map of status codes to quantities # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_inventory_with_http_info(async_req=True)
>>> result = thread.get()
Keyword Args:
async_req (bool): execute request asynchronously
param _preload_content (bool): if False, the urllib3.HTTPResponse
object will be returned without reading/decoding response data.
Default is True.
param _request_timeout (float/tuple): timeout setting for this
request. If one number provided, it will be total request
timeout. It can also be a pair (tuple) of (connection, read)
timeouts.
Returns:
dict(str, int):
"""
local_var_params = locals()
all_params = [] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
for key, val in six.iteritems(local_var_params['kwargs']):
if key not in all_params:
raise ApiTypeError(
"Got an unexpected keyword argument '%s'"
" to method get_inventory" % key
)
local_var_params[key] = val
del local_var_params['kwargs']
collection_formats = {}
path_params = {}
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['api_key'] # noqa: E501
return self.api_client.call_api(
'/store/inventory', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='dict(str, int)', # noqa: E501
auth_settings=auth_settings,
async_req=local_var_params.get('async_req'),
_return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
_preload_content=local_var_params.get('_preload_content', True),
_request_timeout=local_var_params.get('_request_timeout'),
collection_formats=collection_formats)
def get_order_by_id(self, order_id, **kwargs): # noqa: E501
"""Find purchase order by ID # noqa: E501
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_order_by_id(order_id, async_req=True)
>>> result = thread.get()
Args:
order_id (int): ID of pet that needs to be fetched
Keyword Args:
async_req (bool): execute request asynchronously
param _preload_content (bool): if False, the urllib3.HTTPResponse
object will be returned without reading/decoding response data.
Default is True.
param _request_timeout (float/tuple): timeout setting for this
request. If one number provided, it will be total request
timeout. It can also be a pair (tuple) of (connection, read)
timeouts.
Returns:
Order:
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.get_order_by_id_with_http_info(order_id, **kwargs) # noqa: E501
else:
(data) = self.get_order_by_id_with_http_info(order_id, **kwargs) # noqa: E501
return data
def get_order_by_id_with_http_info(self, order_id, **kwargs): # noqa: E501
"""Find purchase order by ID # noqa: E501
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_order_by_id_with_http_info(order_id, async_req=True)
>>> result = thread.get()
Args:
order_id (int): ID of pet that needs to be fetched
Keyword Args:
async_req (bool): execute request asynchronously
param _preload_content (bool): if False, the urllib3.HTTPResponse
object will be returned without reading/decoding response data.
Default is True.
param _request_timeout (float/tuple): timeout setting for this
request. If one number provided, it will be total request
timeout. It can also be a pair (tuple) of (connection, read)
timeouts.
Returns:
Order:
"""
local_var_params = locals()
all_params = ['order_id'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
for key, val in six.iteritems(local_var_params['kwargs']):
if key not in all_params:
raise ApiTypeError(
"Got an unexpected keyword argument '%s'"
" to method get_order_by_id" % key
)
local_var_params[key] = val
del local_var_params['kwargs']
# verify the required parameter 'order_id' is set
if ('order_id' not in local_var_params or
local_var_params['order_id'] is None):
raise ApiValueError("Missing the required parameter `order_id` when calling `get_order_by_id`") # noqa: E501
if 'order_id' in local_var_params and local_var_params['order_id'] > 5: # noqa: E501
raise ApiValueError("Invalid value for parameter `order_id` when calling `get_order_by_id`, must be a value less than or equal to `5`") # noqa: E501
if 'order_id' in local_var_params and local_var_params['order_id'] < 1: # noqa: E501
raise ApiValueError("Invalid value for parameter `order_id` when calling `get_order_by_id`, must be a value greater than or equal to `1`") # noqa: E501
collection_formats = {}
path_params = {}
if 'order_id' in local_var_params:
path_params['order_id'] = local_var_params['order_id'] # noqa: E501
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/xml', 'application/json']) # noqa: E501
# Authentication setting
auth_settings = [] # noqa: E501
return self.api_client.call_api(
'/store/order/{order_id}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='Order', # noqa: E501
auth_settings=auth_settings,
async_req=local_var_params.get('async_req'),
_return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
_preload_content=local_var_params.get('_preload_content', True),
_request_timeout=local_var_params.get('_request_timeout'),
collection_formats=collection_formats)
def place_order(self, body, **kwargs): # noqa: E501
"""Place an order for a pet # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.place_order(body, async_req=True)
>>> result = thread.get()
Args:
body (Order): order placed for purchasing the pet
Keyword Args:
async_req (bool): execute request asynchronously
param _preload_content (bool): if False, the urllib3.HTTPResponse
object will be returned without reading/decoding response data.
Default is True.
param _request_timeout (float/tuple): timeout setting for this
request. If one number provided, it will be total request
timeout. It can also be a pair (tuple) of (connection, read)
timeouts.
Returns:
Order:
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.place_order_with_http_info(body, **kwargs) # noqa: E501
else:
(data) = self.place_order_with_http_info(body, **kwargs) # noqa: E501
return data
def place_order_with_http_info(self, body, **kwargs): # noqa: E501
"""Place an order for a pet # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.place_order_with_http_info(body, async_req=True)
>>> result = thread.get()
Args:
body (Order): order placed for purchasing the pet
Keyword Args:
async_req (bool): execute request asynchronously
param _preload_content (bool): if False, the urllib3.HTTPResponse
object will be returned without reading/decoding response data.
Default is True.
param _request_timeout (float/tuple): timeout setting for this
request. If one number provided, it will be total request
timeout. It can also be a pair (tuple) of (connection, read)
timeouts.
Returns:
Order:
"""
local_var_params = locals()
all_params = ['body'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
for key, val in six.iteritems(local_var_params['kwargs']):
if key not in all_params:
raise ApiTypeError(
"Got an unexpected keyword argument '%s'"
" to method place_order" % key
)
local_var_params[key] = val
del local_var_params['kwargs']
# verify the required parameter 'body' is set
if ('body' not in local_var_params or
local_var_params['body'] is None):
raise ApiValueError("Missing the required parameter `body` when calling `place_order`") # noqa: E501
collection_formats = {}
path_params = {}
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
if 'body' in local_var_params:
body_params = local_var_params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/xml', 'application/json']) # noqa: E501
# Authentication setting
auth_settings = [] # noqa: E501
return self.api_client.call_api(
'/store/order', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='Order', # noqa: E501
auth_settings=auth_settings,
async_req=local_var_params.get('async_req'),
_return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
_preload_content=local_var_params.get('_preload_content', True),
_request_timeout=local_var_params.get('_request_timeout'),
collection_formats=collection_formats)
self.settings['endpoint_path'], self.settings['http_method'],
params['path'],
params['query'],
params['header'],
body=params['body'],
post_params=params['form'],
files=params['file'],
response_type=self.settings['response_type'],
auth_settings=self.settings['auth'],
async_req=kwargs.get('async_req'),
_return_http_data_only=kwargs.get('_return_http_data_only'),
_preload_content=kwargs.get('_preload_content', True),
_request_timeout=kwargs.get('_request_timeout'),
_host=_host,
collection_formats=params['collection_format'])

View File

@ -11,6 +11,7 @@
from __future__ import absolute_import
import datetime
import inspect
import json
import mimetypes
from multiprocessing.pool import ThreadPool
@ -22,9 +23,13 @@ import tempfile
import six
from six.moves.urllib.parse import quote
from petstore_api.configuration import Configuration
import petstore_api.models
from petstore_api import rest
from petstore_api.configuration import Configuration
from petstore_api.model_utils import (
ModelNormal,
ModelSimple
)
from petstore_api.exceptions import ApiValueError
@ -216,7 +221,7 @@ class ApiClient(object):
if isinstance(obj, dict):
obj_dict = obj
else:
elif isinstance(obj, ModelNormal):
# Convert model obj to dict except
# attributes `openapi_types`, `attribute_map`
# and attributes which value is not None.
@ -225,6 +230,8 @@ class ApiClient(object):
obj_dict = {obj.attribute_map[attr]: getattr(obj, attr)
for attr, _ in six.iteritems(obj.openapi_types)
if getattr(obj, attr) is not None}
elif isinstance(obj, ModelSimple):
return self.sanitize_for_serialization(obj.value)
return {key: self.sanitize_for_serialization(val)
for key, val in six.iteritems(obj_dict)}
@ -563,6 +570,8 @@ class ApiClient(object):
return six.text_type(data)
except TypeError:
return data
except ValueError as exc:
raise ApiValueError(str(exc))
def __deserialize_object(self, value):
"""Return an original value.
@ -614,25 +623,39 @@ class ApiClient(object):
"""Deserializes list or dict to model.
:param data: dict, list.
:param klass: class literal.
:param klass: class literal, ModelSimple or ModelNormal
:return: model object.
"""
if not klass.openapi_types and not hasattr(klass,
'get_real_child_model'):
return data
if issubclass(klass, ModelSimple):
value = self.__deserialize(data, klass.openapi_types['value'])
return klass(value)
kwargs = {}
# code to handle ModelNormal
used_data = data
if not isinstance(data, (list, dict)):
used_data = [data]
keyword_args = {}
positional_args = []
if klass.openapi_types is not None:
for attr, attr_type in six.iteritems(klass.openapi_types):
if (data is not None and
klass.attribute_map[attr] in data and
isinstance(data, (list, dict))):
value = data[klass.attribute_map[attr]]
kwargs[attr] = self.__deserialize(value, attr_type)
instance = klass(**kwargs)
klass.attribute_map[attr] in used_data):
value = used_data[klass.attribute_map[attr]]
keyword_args[attr] = self.__deserialize(value, attr_type)
end_index = None
argspec = inspect.getargspec(getattr(klass, '__init__'))
if argspec.defaults:
end_index = -len(argspec.defaults)
required_positional_args = argspec.args[1:end_index]
for index, req_positional_arg in enumerate(required_positional_args):
if keyword_args and req_positional_arg in keyword_args:
positional_args.append(keyword_args[req_positional_arg])
del keyword_args[req_positional_arg]
elif (not keyword_args and index < len(used_data) and
isinstance(used_data, list)):
positional_args.append(used_data[index])
instance = klass(*positional_args, **keyword_args)
if hasattr(instance, 'get_real_child_model'):
klass_name = instance.get_real_child_model(data)
if klass_name:

View File

@ -67,6 +67,9 @@ class Configuration(six.with_metaclass(TypeWithDefault, object)):
self.api_key_prefix = api_key_prefix
"""dict to store API prefix (e.g. Bearer)
"""
self.refresh_api_key_hook = None
"""function hook to refresh API key if expired
"""
self.username = username
"""Username for HTTP basic authentication
"""
@ -227,11 +230,15 @@ class Configuration(six.with_metaclass(TypeWithDefault, object)):
:param identifier: The identifier of apiKey.
:return: The token for api key authentication.
"""
if (self.api_key.get(identifier) and
self.api_key_prefix.get(identifier)):
return self.api_key_prefix[identifier] + ' ' + self.api_key[identifier] # noqa: E501
elif self.api_key.get(identifier):
return self.api_key[identifier]
if self.refresh_api_key_hook is not None:
self.refresh_api_key_hook(self)
key = self.api_key.get(identifier)
if key:
prefix = self.api_key_prefix.get(identifier)
if prefix:
return "%s %s" % (prefix, key)
else:
return key
def get_basic_auth_token(self):
"""Gets HTTP basic authentication header (string).

View File

@ -0,0 +1,183 @@
# coding: utf-8
"""
OpenAPI Petstore
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
"""
import re
from petstore_api.exceptions import ApiValueError
def check_allowed_values(allowed_values, input_variable_path, input_values,
validations):
"""Raises an exception if the input_values are not allowed
Args:
allowed_values (dict): the allowed_values dict
input_variable_path (tuple): the path to the input variable
input_values (list/str/int/float/date/datetime): the values that we
are checking to see if they are in allowed_values
validations (dict): the validations dict
"""
min_collection_length = (
validations.get(input_variable_path, {}).get('min_length') or
validations.get(input_variable_path, {}).get('min_items', 0))
these_allowed_values = list(allowed_values[input_variable_path].values())
if (isinstance(input_values, list)
and len(input_values) > min_collection_length
and not set(input_values).issubset(
set(these_allowed_values))):
invalid_values = ", ".join(
map(str, set(input_values) - set(these_allowed_values))),
raise ApiValueError(
"Invalid values for `%s` [%s], must be a subset of [%s]" %
(
input_variable_path[0],
invalid_values,
", ".join(map(str, these_allowed_values))
)
)
elif (isinstance(input_values, dict)
and len(input_values) > min_collection_length
and not set(
input_values.keys()).issubset(set(these_allowed_values))):
invalid_values = ", ".join(
map(str, set(input_values.keys()) - set(these_allowed_values)))
raise ApiValueError(
"Invalid keys in `%s` [%s], must be a subset of [%s]" %
(
input_variable_path[0],
invalid_values,
", ".join(map(str, these_allowed_values))
)
)
elif (not isinstance(input_values, (list, dict))
and input_values not in these_allowed_values):
raise ApiValueError(
"Invalid value for `%s` (%s), must be one of %s" %
(
input_variable_path[0],
input_values,
these_allowed_values
)
)
def check_validations(validations, input_variable_path, input_values):
"""Raises an exception if the input_values are invalid
Args:
validations (dict): the validation dictionary
input_variable_path (tuple): the path to the input variable
input_values (list/str/int/float/date/datetime): the values that we
are checking
"""
current_validations = validations[input_variable_path]
if ('max_length' in current_validations and
len(input_values) > current_validations['max_length']):
raise ApiValueError(
"Invalid value for `%s`, length must be less than or equal to "
"`%s`" % (
input_variable_path[0],
current_validations['max_length']
)
)
if ('min_length' in current_validations and
len(input_values) < current_validations['min_length']):
raise ApiValueError(
"Invalid value for `%s`, length must be greater than or equal to "
"`%s`" % (
input_variable_path[0],
current_validations['min_length']
)
)
if ('max_items' in current_validations and
len(input_values) > current_validations['max_items']):
raise ApiValueError(
"Invalid value for `%s`, number of items must be less than or "
"equal to `%s`" % (
input_variable_path[0],
current_validations['max_items']
)
)
if ('min_items' in current_validations and
len(input_values) < current_validations['min_items']):
raise ValueError(
"Invalid value for `%s`, number of items must be greater than or "
"equal to `%s`" % (
input_variable_path[0],
current_validations['min_items']
)
)
if ('exclusive_maximum' in current_validations and
input_values >= current_validations['exclusive_maximum']):
raise ApiValueError(
"Invalid value for `%s`, must be a value less than `%s`" % (
input_variable_path[0],
current_validations['exclusive_maximum']
)
)
if ('inclusive_maximum' in current_validations and
input_values > current_validations['inclusive_maximum']):
raise ApiValueError(
"Invalid value for `%s`, must be a value less than or equal to "
"`%s`" % (
input_variable_path[0],
current_validations['inclusive_maximum']
)
)
if ('exclusive_minimum' in current_validations and
input_values <= current_validations['exclusive_minimum']):
raise ApiValueError(
"Invalid value for `%s`, must be a value greater than `%s`" %
(
input_variable_path[0],
current_validations['exclusive_maximum']
)
)
if ('inclusive_minimum' in current_validations and
input_values < current_validations['inclusive_minimum']):
raise ApiValueError(
"Invalid value for `%s`, must be a value greater than or equal "
"to `%s`" % (
input_variable_path[0],
current_validations['inclusive_minimum']
)
)
flags = current_validations.get('regex', {}).get('flags', 0)
if ('regex' in current_validations and
not re.search(current_validations['regex']['pattern'],
input_values, flags=flags)):
raise ApiValueError(
r"Invalid value for `%s`, must be a follow pattern or equal to "
r"`%s` with flags=`%s`" % (
input_variable_path[0],
current_validations['regex']['pattern'],
flags
)
)
class ModelSimple(object):
# the parent class of models whose type != object in their swagger/openapi
# spec
pass
class ModelNormal(object):
# the parent class of models whose type == object in their swagger/openapi
# spec
pass

View File

@ -52,9 +52,11 @@ from petstore_api.models.number_only import NumberOnly
from petstore_api.models.order import Order
from petstore_api.models.outer_composite import OuterComposite
from petstore_api.models.outer_enum import OuterEnum
from petstore_api.models.outer_number import OuterNumber
from petstore_api.models.pet import Pet
from petstore_api.models.read_only_first import ReadOnlyFirst
from petstore_api.models.special_model_name import SpecialModelName
from petstore_api.models.string_boolean_map import StringBooleanMap
from petstore_api.models.tag import Tag
from petstore_api.models.type_holder_default import TypeHolderDefault
from petstore_api.models.type_holder_example import TypeHolderExample

View File

@ -10,48 +10,68 @@
"""
import pprint
import pprint # noqa: F401
import re # noqa: F401
import six
import six # noqa: F401
from petstore_api.exceptions import ApiValueError # noqa: F401
from petstore_api.model_utils import ( # noqa: F401
ModelNormal,
ModelSimple,
check_allowed_values,
check_validations
)
class AdditionalPropertiesAnyType(object):
class AdditionalPropertiesAnyType(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
discriminator_value_class_map (dict): A dict to go from the discriminator
variable value to the discriminator class name.
openapi_types (dict): The key is attribute name
and the value is attribute type.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
"""
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
openapi_types = {
'name': 'str',
allowed_values = {
}
attribute_map = {
'name': 'name', # noqa: E501
'name': 'name' # noqa: E501
}
openapi_types = {
'name': 'str'
}
validations = {
}
def __init__(self, name=None): # noqa: E501
"""AdditionalPropertiesAnyType - a model defined in OpenAPI
Keyword Args:
name (str): [optional] # noqa: E501
"""
"""AdditionalPropertiesAnyType - a model defined in OpenAPI""" # noqa: E501
self._name = None
self.discriminator = None
if name is not None:
self.name = name # noqa: E501
self.name = (
name
)
@property
def name(self):
@ -64,9 +84,7 @@ class AdditionalPropertiesAnyType(object):
return self._name
@name.setter
def name(
self,
name):
def name(self, name): # noqa: E501
"""Sets the name of this AdditionalPropertiesAnyType.
@ -75,7 +93,8 @@ class AdditionalPropertiesAnyType(object):
"""
self._name = (
name)
name
)
def to_dict(self):
"""Returns the model properties as a dict"""

View File

@ -10,48 +10,68 @@
"""
import pprint
import pprint # noqa: F401
import re # noqa: F401
import six
import six # noqa: F401
from petstore_api.exceptions import ApiValueError # noqa: F401
from petstore_api.model_utils import ( # noqa: F401
ModelNormal,
ModelSimple,
check_allowed_values,
check_validations
)
class AdditionalPropertiesArray(object):
class AdditionalPropertiesArray(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
discriminator_value_class_map (dict): A dict to go from the discriminator
variable value to the discriminator class name.
openapi_types (dict): The key is attribute name
and the value is attribute type.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
"""
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
openapi_types = {
'name': 'str',
allowed_values = {
}
attribute_map = {
'name': 'name', # noqa: E501
'name': 'name' # noqa: E501
}
openapi_types = {
'name': 'str'
}
validations = {
}
def __init__(self, name=None): # noqa: E501
"""AdditionalPropertiesArray - a model defined in OpenAPI
Keyword Args:
name (str): [optional] # noqa: E501
"""
"""AdditionalPropertiesArray - a model defined in OpenAPI""" # noqa: E501
self._name = None
self.discriminator = None
if name is not None:
self.name = name # noqa: E501
self.name = (
name
)
@property
def name(self):
@ -64,9 +84,7 @@ class AdditionalPropertiesArray(object):
return self._name
@name.setter
def name(
self,
name):
def name(self, name): # noqa: E501
"""Sets the name of this AdditionalPropertiesArray.
@ -75,7 +93,8 @@ class AdditionalPropertiesArray(object):
"""
self._name = (
name)
name
)
def to_dict(self):
"""Returns the model properties as a dict"""

View File

@ -10,48 +10,68 @@
"""
import pprint
import pprint # noqa: F401
import re # noqa: F401
import six
import six # noqa: F401
from petstore_api.exceptions import ApiValueError # noqa: F401
from petstore_api.model_utils import ( # noqa: F401
ModelNormal,
ModelSimple,
check_allowed_values,
check_validations
)
class AdditionalPropertiesBoolean(object):
class AdditionalPropertiesBoolean(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
discriminator_value_class_map (dict): A dict to go from the discriminator
variable value to the discriminator class name.
openapi_types (dict): The key is attribute name
and the value is attribute type.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
"""
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
openapi_types = {
'name': 'str',
allowed_values = {
}
attribute_map = {
'name': 'name', # noqa: E501
'name': 'name' # noqa: E501
}
openapi_types = {
'name': 'str'
}
validations = {
}
def __init__(self, name=None): # noqa: E501
"""AdditionalPropertiesBoolean - a model defined in OpenAPI
Keyword Args:
name (str): [optional] # noqa: E501
"""
"""AdditionalPropertiesBoolean - a model defined in OpenAPI""" # noqa: E501
self._name = None
self.discriminator = None
if name is not None:
self.name = name # noqa: E501
self.name = (
name
)
@property
def name(self):
@ -64,9 +84,7 @@ class AdditionalPropertiesBoolean(object):
return self._name
@name.setter
def name(
self,
name):
def name(self, name): # noqa: E501
"""Sets the name of this AdditionalPropertiesBoolean.
@ -75,7 +93,8 @@ class AdditionalPropertiesBoolean(object):
"""
self._name = (
name)
name
)
def to_dict(self):
"""Returns the model properties as a dict"""

View File

@ -10,38 +10,45 @@
"""
import pprint
import pprint # noqa: F401
import re # noqa: F401
import six
import six # noqa: F401
from petstore_api.exceptions import ApiValueError # noqa: F401
from petstore_api.model_utils import ( # noqa: F401
ModelNormal,
ModelSimple,
check_allowed_values,
check_validations
)
class AdditionalPropertiesClass(object):
class AdditionalPropertiesClass(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
discriminator_value_class_map (dict): A dict to go from the discriminator
variable value to the discriminator class name.
openapi_types (dict): The key is attribute name
and the value is attribute type.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
"""
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
openapi_types = {
'map_string': 'dict(str, str)',
'map_number': 'dict(str, float)',
'map_integer': 'dict(str, int)',
'map_boolean': 'dict(str, bool)',
'map_array_integer': 'dict(str, list[int])',
'map_array_anytype': 'dict(str, list[object])',
'map_map_string': 'dict(str, dict(str, str))',
'map_map_anytype': 'dict(str, dict(str, object))',
'anytype_1': 'object',
'anytype_2': 'object',
'anytype_3': 'object',
allowed_values = {
}
attribute_map = {
@ -55,27 +62,28 @@ class AdditionalPropertiesClass(object):
'map_map_anytype': 'map_map_anytype', # noqa: E501
'anytype_1': 'anytype_1', # noqa: E501
'anytype_2': 'anytype_2', # noqa: E501
'anytype_3': 'anytype_3', # noqa: E501
'anytype_3': 'anytype_3' # noqa: E501
}
openapi_types = {
'map_string': 'dict(str, str)',
'map_number': 'dict(str, float)',
'map_integer': 'dict(str, int)',
'map_boolean': 'dict(str, bool)',
'map_array_integer': 'dict(str, list[int])',
'map_array_anytype': 'dict(str, list[object])',
'map_map_string': 'dict(str, dict(str, str))',
'map_map_anytype': 'dict(str, dict(str, object))',
'anytype_1': 'object',
'anytype_2': 'object',
'anytype_3': 'object'
}
validations = {
}
def __init__(self, map_string=None, map_number=None, map_integer=None, map_boolean=None, map_array_integer=None, map_array_anytype=None, map_map_string=None, map_map_anytype=None, anytype_1=None, anytype_2=None, anytype_3=None): # noqa: E501
"""AdditionalPropertiesClass - a model defined in OpenAPI
Keyword Args:
map_string (dict(str, str)): [optional] # noqa: E501
map_number (dict(str, float)): [optional] # noqa: E501
map_integer (dict(str, int)): [optional] # noqa: E501
map_boolean (dict(str, bool)): [optional] # noqa: E501
map_array_integer (dict(str, list[int])): [optional] # noqa: E501
map_array_anytype (dict(str, list[object])): [optional] # noqa: E501
map_map_string (dict(str, dict(str, str))): [optional] # noqa: E501
map_map_anytype (dict(str, dict(str, object))): [optional] # noqa: E501
anytype_1 (object): [optional] # noqa: E501
anytype_2 (object): [optional] # noqa: E501
anytype_3 (object): [optional] # noqa: E501
"""
"""AdditionalPropertiesClass - a model defined in OpenAPI""" # noqa: E501
self._map_string = None
self._map_number = None
@ -91,27 +99,49 @@ class AdditionalPropertiesClass(object):
self.discriminator = None
if map_string is not None:
self.map_string = map_string # noqa: E501
self.map_string = (
map_string
)
if map_number is not None:
self.map_number = map_number # noqa: E501
self.map_number = (
map_number
)
if map_integer is not None:
self.map_integer = map_integer # noqa: E501
self.map_integer = (
map_integer
)
if map_boolean is not None:
self.map_boolean = map_boolean # noqa: E501
self.map_boolean = (
map_boolean
)
if map_array_integer is not None:
self.map_array_integer = map_array_integer # noqa: E501
self.map_array_integer = (
map_array_integer
)
if map_array_anytype is not None:
self.map_array_anytype = map_array_anytype # noqa: E501
self.map_array_anytype = (
map_array_anytype
)
if map_map_string is not None:
self.map_map_string = map_map_string # noqa: E501
self.map_map_string = (
map_map_string
)
if map_map_anytype is not None:
self.map_map_anytype = map_map_anytype # noqa: E501
self.map_map_anytype = (
map_map_anytype
)
if anytype_1 is not None:
self.anytype_1 = anytype_1 # noqa: E501
self.anytype_1 = (
anytype_1
)
if anytype_2 is not None:
self.anytype_2 = anytype_2 # noqa: E501
self.anytype_2 = (
anytype_2
)
if anytype_3 is not None:
self.anytype_3 = anytype_3 # noqa: E501
self.anytype_3 = (
anytype_3
)
@property
def map_string(self):
@ -124,9 +154,7 @@ class AdditionalPropertiesClass(object):
return self._map_string
@map_string.setter
def map_string(
self,
map_string):
def map_string(self, map_string): # noqa: E501
"""Sets the map_string of this AdditionalPropertiesClass.
@ -135,7 +163,8 @@ class AdditionalPropertiesClass(object):
"""
self._map_string = (
map_string)
map_string
)
@property
def map_number(self):
@ -148,9 +177,7 @@ class AdditionalPropertiesClass(object):
return self._map_number
@map_number.setter
def map_number(
self,
map_number):
def map_number(self, map_number): # noqa: E501
"""Sets the map_number of this AdditionalPropertiesClass.
@ -159,7 +186,8 @@ class AdditionalPropertiesClass(object):
"""
self._map_number = (
map_number)
map_number
)
@property
def map_integer(self):
@ -172,9 +200,7 @@ class AdditionalPropertiesClass(object):
return self._map_integer
@map_integer.setter
def map_integer(
self,
map_integer):
def map_integer(self, map_integer): # noqa: E501
"""Sets the map_integer of this AdditionalPropertiesClass.
@ -183,7 +209,8 @@ class AdditionalPropertiesClass(object):
"""
self._map_integer = (
map_integer)
map_integer
)
@property
def map_boolean(self):
@ -196,9 +223,7 @@ class AdditionalPropertiesClass(object):
return self._map_boolean
@map_boolean.setter
def map_boolean(
self,
map_boolean):
def map_boolean(self, map_boolean): # noqa: E501
"""Sets the map_boolean of this AdditionalPropertiesClass.
@ -207,7 +232,8 @@ class AdditionalPropertiesClass(object):
"""
self._map_boolean = (
map_boolean)
map_boolean
)
@property
def map_array_integer(self):
@ -220,9 +246,7 @@ class AdditionalPropertiesClass(object):
return self._map_array_integer
@map_array_integer.setter
def map_array_integer(
self,
map_array_integer):
def map_array_integer(self, map_array_integer): # noqa: E501
"""Sets the map_array_integer of this AdditionalPropertiesClass.
@ -231,7 +255,8 @@ class AdditionalPropertiesClass(object):
"""
self._map_array_integer = (
map_array_integer)
map_array_integer
)
@property
def map_array_anytype(self):
@ -244,9 +269,7 @@ class AdditionalPropertiesClass(object):
return self._map_array_anytype
@map_array_anytype.setter
def map_array_anytype(
self,
map_array_anytype):
def map_array_anytype(self, map_array_anytype): # noqa: E501
"""Sets the map_array_anytype of this AdditionalPropertiesClass.
@ -255,7 +278,8 @@ class AdditionalPropertiesClass(object):
"""
self._map_array_anytype = (
map_array_anytype)
map_array_anytype
)
@property
def map_map_string(self):
@ -268,9 +292,7 @@ class AdditionalPropertiesClass(object):
return self._map_map_string
@map_map_string.setter
def map_map_string(
self,
map_map_string):
def map_map_string(self, map_map_string): # noqa: E501
"""Sets the map_map_string of this AdditionalPropertiesClass.
@ -279,7 +301,8 @@ class AdditionalPropertiesClass(object):
"""
self._map_map_string = (
map_map_string)
map_map_string
)
@property
def map_map_anytype(self):
@ -292,9 +315,7 @@ class AdditionalPropertiesClass(object):
return self._map_map_anytype
@map_map_anytype.setter
def map_map_anytype(
self,
map_map_anytype):
def map_map_anytype(self, map_map_anytype): # noqa: E501
"""Sets the map_map_anytype of this AdditionalPropertiesClass.
@ -303,7 +324,8 @@ class AdditionalPropertiesClass(object):
"""
self._map_map_anytype = (
map_map_anytype)
map_map_anytype
)
@property
def anytype_1(self):
@ -316,9 +338,7 @@ class AdditionalPropertiesClass(object):
return self._anytype_1
@anytype_1.setter
def anytype_1(
self,
anytype_1):
def anytype_1(self, anytype_1): # noqa: E501
"""Sets the anytype_1 of this AdditionalPropertiesClass.
@ -327,7 +347,8 @@ class AdditionalPropertiesClass(object):
"""
self._anytype_1 = (
anytype_1)
anytype_1
)
@property
def anytype_2(self):
@ -340,9 +361,7 @@ class AdditionalPropertiesClass(object):
return self._anytype_2
@anytype_2.setter
def anytype_2(
self,
anytype_2):
def anytype_2(self, anytype_2): # noqa: E501
"""Sets the anytype_2 of this AdditionalPropertiesClass.
@ -351,7 +370,8 @@ class AdditionalPropertiesClass(object):
"""
self._anytype_2 = (
anytype_2)
anytype_2
)
@property
def anytype_3(self):
@ -364,9 +384,7 @@ class AdditionalPropertiesClass(object):
return self._anytype_3
@anytype_3.setter
def anytype_3(
self,
anytype_3):
def anytype_3(self, anytype_3): # noqa: E501
"""Sets the anytype_3 of this AdditionalPropertiesClass.
@ -375,7 +393,8 @@ class AdditionalPropertiesClass(object):
"""
self._anytype_3 = (
anytype_3)
anytype_3
)
def to_dict(self):
"""Returns the model properties as a dict"""

View File

@ -10,48 +10,68 @@
"""
import pprint
import pprint # noqa: F401
import re # noqa: F401
import six
import six # noqa: F401
from petstore_api.exceptions import ApiValueError # noqa: F401
from petstore_api.model_utils import ( # noqa: F401
ModelNormal,
ModelSimple,
check_allowed_values,
check_validations
)
class AdditionalPropertiesInteger(object):
class AdditionalPropertiesInteger(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
discriminator_value_class_map (dict): A dict to go from the discriminator
variable value to the discriminator class name.
openapi_types (dict): The key is attribute name
and the value is attribute type.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
"""
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
openapi_types = {
'name': 'str',
allowed_values = {
}
attribute_map = {
'name': 'name', # noqa: E501
'name': 'name' # noqa: E501
}
openapi_types = {
'name': 'str'
}
validations = {
}
def __init__(self, name=None): # noqa: E501
"""AdditionalPropertiesInteger - a model defined in OpenAPI
Keyword Args:
name (str): [optional] # noqa: E501
"""
"""AdditionalPropertiesInteger - a model defined in OpenAPI""" # noqa: E501
self._name = None
self.discriminator = None
if name is not None:
self.name = name # noqa: E501
self.name = (
name
)
@property
def name(self):
@ -64,9 +84,7 @@ class AdditionalPropertiesInteger(object):
return self._name
@name.setter
def name(
self,
name):
def name(self, name): # noqa: E501
"""Sets the name of this AdditionalPropertiesInteger.
@ -75,7 +93,8 @@ class AdditionalPropertiesInteger(object):
"""
self._name = (
name)
name
)
def to_dict(self):
"""Returns the model properties as a dict"""

View File

@ -10,48 +10,68 @@
"""
import pprint
import pprint # noqa: F401
import re # noqa: F401
import six
import six # noqa: F401
from petstore_api.exceptions import ApiValueError # noqa: F401
from petstore_api.model_utils import ( # noqa: F401
ModelNormal,
ModelSimple,
check_allowed_values,
check_validations
)
class AdditionalPropertiesNumber(object):
class AdditionalPropertiesNumber(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
discriminator_value_class_map (dict): A dict to go from the discriminator
variable value to the discriminator class name.
openapi_types (dict): The key is attribute name
and the value is attribute type.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
"""
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
openapi_types = {
'name': 'str',
allowed_values = {
}
attribute_map = {
'name': 'name', # noqa: E501
'name': 'name' # noqa: E501
}
openapi_types = {
'name': 'str'
}
validations = {
}
def __init__(self, name=None): # noqa: E501
"""AdditionalPropertiesNumber - a model defined in OpenAPI
Keyword Args:
name (str): [optional] # noqa: E501
"""
"""AdditionalPropertiesNumber - a model defined in OpenAPI""" # noqa: E501
self._name = None
self.discriminator = None
if name is not None:
self.name = name # noqa: E501
self.name = (
name
)
@property
def name(self):
@ -64,9 +84,7 @@ class AdditionalPropertiesNumber(object):
return self._name
@name.setter
def name(
self,
name):
def name(self, name): # noqa: E501
"""Sets the name of this AdditionalPropertiesNumber.
@ -75,7 +93,8 @@ class AdditionalPropertiesNumber(object):
"""
self._name = (
name)
name
)
def to_dict(self):
"""Returns the model properties as a dict"""

View File

@ -10,48 +10,68 @@
"""
import pprint
import pprint # noqa: F401
import re # noqa: F401
import six
import six # noqa: F401
from petstore_api.exceptions import ApiValueError # noqa: F401
from petstore_api.model_utils import ( # noqa: F401
ModelNormal,
ModelSimple,
check_allowed_values,
check_validations
)
class AdditionalPropertiesObject(object):
class AdditionalPropertiesObject(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
discriminator_value_class_map (dict): A dict to go from the discriminator
variable value to the discriminator class name.
openapi_types (dict): The key is attribute name
and the value is attribute type.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
"""
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
openapi_types = {
'name': 'str',
allowed_values = {
}
attribute_map = {
'name': 'name', # noqa: E501
'name': 'name' # noqa: E501
}
openapi_types = {
'name': 'str'
}
validations = {
}
def __init__(self, name=None): # noqa: E501
"""AdditionalPropertiesObject - a model defined in OpenAPI
Keyword Args:
name (str): [optional] # noqa: E501
"""
"""AdditionalPropertiesObject - a model defined in OpenAPI""" # noqa: E501
self._name = None
self.discriminator = None
if name is not None:
self.name = name # noqa: E501
self.name = (
name
)
@property
def name(self):
@ -64,9 +84,7 @@ class AdditionalPropertiesObject(object):
return self._name
@name.setter
def name(
self,
name):
def name(self, name): # noqa: E501
"""Sets the name of this AdditionalPropertiesObject.
@ -75,7 +93,8 @@ class AdditionalPropertiesObject(object):
"""
self._name = (
name)
name
)
def to_dict(self):
"""Returns the model properties as a dict"""

View File

@ -10,48 +10,68 @@
"""
import pprint
import pprint # noqa: F401
import re # noqa: F401
import six
import six # noqa: F401
from petstore_api.exceptions import ApiValueError # noqa: F401
from petstore_api.model_utils import ( # noqa: F401
ModelNormal,
ModelSimple,
check_allowed_values,
check_validations
)
class AdditionalPropertiesString(object):
class AdditionalPropertiesString(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
discriminator_value_class_map (dict): A dict to go from the discriminator
variable value to the discriminator class name.
openapi_types (dict): The key is attribute name
and the value is attribute type.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
"""
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
openapi_types = {
'name': 'str',
allowed_values = {
}
attribute_map = {
'name': 'name', # noqa: E501
'name': 'name' # noqa: E501
}
openapi_types = {
'name': 'str'
}
validations = {
}
def __init__(self, name=None): # noqa: E501
"""AdditionalPropertiesString - a model defined in OpenAPI
Keyword Args:
name (str): [optional] # noqa: E501
"""
"""AdditionalPropertiesString - a model defined in OpenAPI""" # noqa: E501
self._name = None
self.discriminator = None
if name is not None:
self.name = name # noqa: E501
self.name = (
name
)
@property
def name(self):
@ -64,9 +84,7 @@ class AdditionalPropertiesString(object):
return self._name
@name.setter
def name(
self,
name):
def name(self, name): # noqa: E501
"""Sets the name of this AdditionalPropertiesString.
@ -75,7 +93,8 @@ class AdditionalPropertiesString(object):
"""
self._name = (
name)
name
)
def to_dict(self):
"""Returns the model properties as a dict"""

View File

@ -10,34 +10,50 @@
"""
import pprint
import pprint # noqa: F401
import re # noqa: F401
import six
import six # noqa: F401
from petstore_api.exceptions import ApiValueError # noqa: F401
from petstore_api.model_utils import ( # noqa: F401
ModelNormal,
ModelSimple,
check_allowed_values,
check_validations
)
class Animal(object):
class Animal(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
discriminator_value_class_map (dict): A dict to go from the discriminator
variable value to the discriminator class name.
openapi_types (dict): The key is attribute name
and the value is attribute type.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
"""
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
openapi_types = {
'class_name': 'str',
'color': 'str',
allowed_values = {
}
attribute_map = {
'class_name': 'className', # noqa: E501
'color': 'color', # noqa: E501
'color': 'color' # noqa: E501
}
discriminator_value_class_map = {
@ -45,15 +61,16 @@ class Animal(object):
'Cat': 'Cat'
}
def __init__(self, class_name, color=None): # noqa: E501
"""Animal - a model defined in OpenAPI
openapi_types = {
'class_name': 'str',
'color': 'str'
}
Args:
class_name (str):
validations = {
}
Keyword Args: # noqa: E501
color (str): [optional] if omitted the server will use the default value of 'red' # noqa: E501
"""
def __init__(self, class_name=None, color='red'): # noqa: E501
"""Animal - a model defined in OpenAPI""" # noqa: E501
self._class_name = None
self._color = None
@ -61,7 +78,9 @@ class Animal(object):
self.class_name = class_name
if color is not None:
self.color = color # noqa: E501
self.color = (
color
)
@property
def class_name(self):
@ -74,9 +93,7 @@ class Animal(object):
return self._class_name
@class_name.setter
def class_name(
self,
class_name):
def class_name(self, class_name): # noqa: E501
"""Sets the class_name of this Animal.
@ -84,10 +101,11 @@ class Animal(object):
:type: str
"""
if class_name is None:
raise ValueError("Invalid value for `class_name`, must not be `None`") # noqa: E501
raise ApiValueError("Invalid value for `class_name`, must not be `None`") # noqa: E501
self._class_name = (
class_name)
class_name
)
@property
def color(self):
@ -100,9 +118,7 @@ class Animal(object):
return self._color
@color.setter
def color(
self,
color):
def color(self, color): # noqa: E501
"""Sets the color of this Animal.
@ -111,7 +127,8 @@ class Animal(object):
"""
self._color = (
color)
color
)
def get_real_child_model(self, data):
"""Returns the real base class specified by the discriminator"""

View File

@ -10,48 +10,64 @@
"""
import pprint
import pprint # noqa: F401
import re # noqa: F401
import six
import six # noqa: F401
from petstore_api.exceptions import ApiValueError # noqa: F401
from petstore_api.model_utils import ( # noqa: F401
ModelNormal,
ModelSimple,
check_allowed_values,
check_validations
)
class ApiResponse(object):
class ApiResponse(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
discriminator_value_class_map (dict): A dict to go from the discriminator
variable value to the discriminator class name.
openapi_types (dict): The key is attribute name
and the value is attribute type.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
"""
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
openapi_types = {
'code': 'int',
'type': 'str',
'message': 'str',
allowed_values = {
}
attribute_map = {
'code': 'code', # noqa: E501
'type': 'type', # noqa: E501
'message': 'message', # noqa: E501
'message': 'message' # noqa: E501
}
openapi_types = {
'code': 'int',
'type': 'str',
'message': 'str'
}
validations = {
}
def __init__(self, code=None, type=None, message=None): # noqa: E501
"""ApiResponse - a model defined in OpenAPI
Keyword Args:
code (int): [optional] # noqa: E501
type (str): [optional] # noqa: E501
message (str): [optional] # noqa: E501
"""
"""ApiResponse - a model defined in OpenAPI""" # noqa: E501
self._code = None
self._type = None
@ -59,11 +75,17 @@ class ApiResponse(object):
self.discriminator = None
if code is not None:
self.code = code # noqa: E501
self.code = (
code
)
if type is not None:
self.type = type # noqa: E501
self.type = (
type
)
if message is not None:
self.message = message # noqa: E501
self.message = (
message
)
@property
def code(self):
@ -76,9 +98,7 @@ class ApiResponse(object):
return self._code
@code.setter
def code(
self,
code):
def code(self, code): # noqa: E501
"""Sets the code of this ApiResponse.
@ -87,7 +107,8 @@ class ApiResponse(object):
"""
self._code = (
code)
code
)
@property
def type(self):
@ -100,9 +121,7 @@ class ApiResponse(object):
return self._type
@type.setter
def type(
self,
type):
def type(self, type): # noqa: E501
"""Sets the type of this ApiResponse.
@ -111,7 +130,8 @@ class ApiResponse(object):
"""
self._type = (
type)
type
)
@property
def message(self):
@ -124,9 +144,7 @@ class ApiResponse(object):
return self._message
@message.setter
def message(
self,
message):
def message(self, message): # noqa: E501
"""Sets the message of this ApiResponse.
@ -135,7 +153,8 @@ class ApiResponse(object):
"""
self._message = (
message)
message
)
def to_dict(self):
"""Returns the model properties as a dict"""

View File

@ -10,48 +10,68 @@
"""
import pprint
import pprint # noqa: F401
import re # noqa: F401
import six
import six # noqa: F401
from petstore_api.exceptions import ApiValueError # noqa: F401
from petstore_api.model_utils import ( # noqa: F401
ModelNormal,
ModelSimple,
check_allowed_values,
check_validations
)
class ArrayOfArrayOfNumberOnly(object):
class ArrayOfArrayOfNumberOnly(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
discriminator_value_class_map (dict): A dict to go from the discriminator
variable value to the discriminator class name.
openapi_types (dict): The key is attribute name
and the value is attribute type.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
"""
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
openapi_types = {
'array_array_number': 'list[list[float]]',
allowed_values = {
}
attribute_map = {
'array_array_number': 'ArrayArrayNumber', # noqa: E501
'array_array_number': 'ArrayArrayNumber' # noqa: E501
}
openapi_types = {
'array_array_number': 'list[list[float]]'
}
validations = {
}
def __init__(self, array_array_number=None): # noqa: E501
"""ArrayOfArrayOfNumberOnly - a model defined in OpenAPI
Keyword Args:
array_array_number (list[list[float]]): [optional] # noqa: E501
"""
"""ArrayOfArrayOfNumberOnly - a model defined in OpenAPI""" # noqa: E501
self._array_array_number = None
self.discriminator = None
if array_array_number is not None:
self.array_array_number = array_array_number # noqa: E501
self.array_array_number = (
array_array_number
)
@property
def array_array_number(self):
@ -64,9 +84,7 @@ class ArrayOfArrayOfNumberOnly(object):
return self._array_array_number
@array_array_number.setter
def array_array_number(
self,
array_array_number):
def array_array_number(self, array_array_number): # noqa: E501
"""Sets the array_array_number of this ArrayOfArrayOfNumberOnly.
@ -75,7 +93,8 @@ class ArrayOfArrayOfNumberOnly(object):
"""
self._array_array_number = (
array_array_number)
array_array_number
)
def to_dict(self):
"""Returns the model properties as a dict"""

View File

@ -10,48 +10,68 @@
"""
import pprint
import pprint # noqa: F401
import re # noqa: F401
import six
import six # noqa: F401
from petstore_api.exceptions import ApiValueError # noqa: F401
from petstore_api.model_utils import ( # noqa: F401
ModelNormal,
ModelSimple,
check_allowed_values,
check_validations
)
class ArrayOfNumberOnly(object):
class ArrayOfNumberOnly(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
discriminator_value_class_map (dict): A dict to go from the discriminator
variable value to the discriminator class name.
openapi_types (dict): The key is attribute name
and the value is attribute type.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
"""
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
openapi_types = {
'array_number': 'list[float]',
allowed_values = {
}
attribute_map = {
'array_number': 'ArrayNumber', # noqa: E501
'array_number': 'ArrayNumber' # noqa: E501
}
openapi_types = {
'array_number': 'list[float]'
}
validations = {
}
def __init__(self, array_number=None): # noqa: E501
"""ArrayOfNumberOnly - a model defined in OpenAPI
Keyword Args:
array_number (list[float]): [optional] # noqa: E501
"""
"""ArrayOfNumberOnly - a model defined in OpenAPI""" # noqa: E501
self._array_number = None
self.discriminator = None
if array_number is not None:
self.array_number = array_number # noqa: E501
self.array_number = (
array_number
)
@property
def array_number(self):
@ -64,9 +84,7 @@ class ArrayOfNumberOnly(object):
return self._array_number
@array_number.setter
def array_number(
self,
array_number):
def array_number(self, array_number): # noqa: E501
"""Sets the array_number of this ArrayOfNumberOnly.
@ -75,7 +93,8 @@ class ArrayOfNumberOnly(object):
"""
self._array_number = (
array_number)
array_number
)
def to_dict(self):
"""Returns the model properties as a dict"""

View File

@ -10,48 +10,64 @@
"""
import pprint
import pprint # noqa: F401
import re # noqa: F401
import six
import six # noqa: F401
from petstore_api.exceptions import ApiValueError # noqa: F401
from petstore_api.model_utils import ( # noqa: F401
ModelNormal,
ModelSimple,
check_allowed_values,
check_validations
)
class ArrayTest(object):
class ArrayTest(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
discriminator_value_class_map (dict): A dict to go from the discriminator
variable value to the discriminator class name.
openapi_types (dict): The key is attribute name
and the value is attribute type.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
"""
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
openapi_types = {
'array_of_string': 'list[str]',
'array_array_of_integer': 'list[list[int]]',
'array_array_of_model': 'list[list[ReadOnlyFirst]]',
allowed_values = {
}
attribute_map = {
'array_of_string': 'array_of_string', # noqa: E501
'array_array_of_integer': 'array_array_of_integer', # noqa: E501
'array_array_of_model': 'array_array_of_model', # noqa: E501
'array_array_of_model': 'array_array_of_model' # noqa: E501
}
openapi_types = {
'array_of_string': 'list[str]',
'array_array_of_integer': 'list[list[int]]',
'array_array_of_model': 'list[list[ReadOnlyFirst]]'
}
validations = {
}
def __init__(self, array_of_string=None, array_array_of_integer=None, array_array_of_model=None): # noqa: E501
"""ArrayTest - a model defined in OpenAPI
Keyword Args:
array_of_string (list[str]): [optional] # noqa: E501
array_array_of_integer (list[list[int]]): [optional] # noqa: E501
array_array_of_model (list[list[ReadOnlyFirst]]): [optional] # noqa: E501
"""
"""ArrayTest - a model defined in OpenAPI""" # noqa: E501
self._array_of_string = None
self._array_array_of_integer = None
@ -59,11 +75,17 @@ class ArrayTest(object):
self.discriminator = None
if array_of_string is not None:
self.array_of_string = array_of_string # noqa: E501
self.array_of_string = (
array_of_string
)
if array_array_of_integer is not None:
self.array_array_of_integer = array_array_of_integer # noqa: E501
self.array_array_of_integer = (
array_array_of_integer
)
if array_array_of_model is not None:
self.array_array_of_model = array_array_of_model # noqa: E501
self.array_array_of_model = (
array_array_of_model
)
@property
def array_of_string(self):
@ -76,9 +98,7 @@ class ArrayTest(object):
return self._array_of_string
@array_of_string.setter
def array_of_string(
self,
array_of_string):
def array_of_string(self, array_of_string): # noqa: E501
"""Sets the array_of_string of this ArrayTest.
@ -87,7 +107,8 @@ class ArrayTest(object):
"""
self._array_of_string = (
array_of_string)
array_of_string
)
@property
def array_array_of_integer(self):
@ -100,9 +121,7 @@ class ArrayTest(object):
return self._array_array_of_integer
@array_array_of_integer.setter
def array_array_of_integer(
self,
array_array_of_integer):
def array_array_of_integer(self, array_array_of_integer): # noqa: E501
"""Sets the array_array_of_integer of this ArrayTest.
@ -111,7 +130,8 @@ class ArrayTest(object):
"""
self._array_array_of_integer = (
array_array_of_integer)
array_array_of_integer
)
@property
def array_array_of_model(self):
@ -124,9 +144,7 @@ class ArrayTest(object):
return self._array_array_of_model
@array_array_of_model.setter
def array_array_of_model(
self,
array_array_of_model):
def array_array_of_model(self, array_array_of_model): # noqa: E501
"""Sets the array_array_of_model of this ArrayTest.
@ -135,7 +153,8 @@ class ArrayTest(object):
"""
self._array_array_of_model = (
array_array_of_model)
array_array_of_model
)
def to_dict(self):
"""Returns the model properties as a dict"""

View File

@ -10,33 +10,45 @@
"""
import pprint
import pprint # noqa: F401
import re # noqa: F401
import six
import six # noqa: F401
from petstore_api.exceptions import ApiValueError # noqa: F401
from petstore_api.model_utils import ( # noqa: F401
ModelNormal,
ModelSimple,
check_allowed_values,
check_validations
)
class Capitalization(object):
class Capitalization(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
discriminator_value_class_map (dict): A dict to go from the discriminator
variable value to the discriminator class name.
openapi_types (dict): The key is attribute name
and the value is attribute type.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
"""
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
openapi_types = {
'small_camel': 'str',
'capital_camel': 'str',
'small_snake': 'str',
'capital_snake': 'str',
'sca_eth_flow_points': 'str',
'att_name': 'str',
allowed_values = {
}
attribute_map = {
@ -45,22 +57,23 @@ class Capitalization(object):
'small_snake': 'small_Snake', # noqa: E501
'capital_snake': 'Capital_Snake', # noqa: E501
'sca_eth_flow_points': 'SCA_ETH_Flow_Points', # noqa: E501
'att_name': 'ATT_NAME', # noqa: E501
'att_name': 'ATT_NAME' # noqa: E501
}
openapi_types = {
'small_camel': 'str',
'capital_camel': 'str',
'small_snake': 'str',
'capital_snake': 'str',
'sca_eth_flow_points': 'str',
'att_name': 'str'
}
validations = {
}
def __init__(self, small_camel=None, capital_camel=None, small_snake=None, capital_snake=None, sca_eth_flow_points=None, att_name=None): # noqa: E501
"""Capitalization - a model defined in OpenAPI
Keyword Args:
small_camel (str): [optional] # noqa: E501
capital_camel (str): [optional] # noqa: E501
small_snake (str): [optional] # noqa: E501
capital_snake (str): [optional] # noqa: E501
sca_eth_flow_points (str): [optional] # noqa: E501
att_name (str): Name of the pet . [optional] # noqa: E501
"""
"""Capitalization - a model defined in OpenAPI""" # noqa: E501
self._small_camel = None
self._capital_camel = None
@ -71,17 +84,29 @@ class Capitalization(object):
self.discriminator = None
if small_camel is not None:
self.small_camel = small_camel # noqa: E501
self.small_camel = (
small_camel
)
if capital_camel is not None:
self.capital_camel = capital_camel # noqa: E501
self.capital_camel = (
capital_camel
)
if small_snake is not None:
self.small_snake = small_snake # noqa: E501
self.small_snake = (
small_snake
)
if capital_snake is not None:
self.capital_snake = capital_snake # noqa: E501
self.capital_snake = (
capital_snake
)
if sca_eth_flow_points is not None:
self.sca_eth_flow_points = sca_eth_flow_points # noqa: E501
self.sca_eth_flow_points = (
sca_eth_flow_points
)
if att_name is not None:
self.att_name = att_name # noqa: E501
self.att_name = (
att_name
)
@property
def small_camel(self):
@ -94,9 +119,7 @@ class Capitalization(object):
return self._small_camel
@small_camel.setter
def small_camel(
self,
small_camel):
def small_camel(self, small_camel): # noqa: E501
"""Sets the small_camel of this Capitalization.
@ -105,7 +128,8 @@ class Capitalization(object):
"""
self._small_camel = (
small_camel)
small_camel
)
@property
def capital_camel(self):
@ -118,9 +142,7 @@ class Capitalization(object):
return self._capital_camel
@capital_camel.setter
def capital_camel(
self,
capital_camel):
def capital_camel(self, capital_camel): # noqa: E501
"""Sets the capital_camel of this Capitalization.
@ -129,7 +151,8 @@ class Capitalization(object):
"""
self._capital_camel = (
capital_camel)
capital_camel
)
@property
def small_snake(self):
@ -142,9 +165,7 @@ class Capitalization(object):
return self._small_snake
@small_snake.setter
def small_snake(
self,
small_snake):
def small_snake(self, small_snake): # noqa: E501
"""Sets the small_snake of this Capitalization.
@ -153,7 +174,8 @@ class Capitalization(object):
"""
self._small_snake = (
small_snake)
small_snake
)
@property
def capital_snake(self):
@ -166,9 +188,7 @@ class Capitalization(object):
return self._capital_snake
@capital_snake.setter
def capital_snake(
self,
capital_snake):
def capital_snake(self, capital_snake): # noqa: E501
"""Sets the capital_snake of this Capitalization.
@ -177,7 +197,8 @@ class Capitalization(object):
"""
self._capital_snake = (
capital_snake)
capital_snake
)
@property
def sca_eth_flow_points(self):
@ -190,9 +211,7 @@ class Capitalization(object):
return self._sca_eth_flow_points
@sca_eth_flow_points.setter
def sca_eth_flow_points(
self,
sca_eth_flow_points):
def sca_eth_flow_points(self, sca_eth_flow_points): # noqa: E501
"""Sets the sca_eth_flow_points of this Capitalization.
@ -201,7 +220,8 @@ class Capitalization(object):
"""
self._sca_eth_flow_points = (
sca_eth_flow_points)
sca_eth_flow_points
)
@property
def att_name(self):
@ -215,9 +235,7 @@ class Capitalization(object):
return self._att_name
@att_name.setter
def att_name(
self,
att_name):
def att_name(self, att_name): # noqa: E501
"""Sets the att_name of this Capitalization.
Name of the pet # noqa: E501
@ -227,7 +245,8 @@ class Capitalization(object):
"""
self._att_name = (
att_name)
att_name
)
def to_dict(self):
"""Returns the model properties as a dict"""

View File

@ -10,54 +10,68 @@
"""
import pprint
import pprint # noqa: F401
import re # noqa: F401
import six
import six # noqa: F401
from petstore_api.exceptions import ApiValueError # noqa: F401
from petstore_api.model_utils import ( # noqa: F401
ModelNormal,
ModelSimple,
check_allowed_values,
check_validations
)
class Cat(object):
class Cat(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
discriminator_value_class_map (dict): A dict to go from the discriminator
variable value to the discriminator class name.
openapi_types (dict): The key is attribute name
and the value is attribute type.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
"""
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
openapi_types = {
'class_name': 'str',
'declawed': 'bool',
'color': 'str',
allowed_values = {
}
attribute_map = {
'class_name': 'className', # noqa: E501
'declawed': 'declawed', # noqa: E501
'color': 'color', # noqa: E501
'declawed': 'declawed' # noqa: E501
}
def __init__(self, class_name, declawed=None, color=None): # noqa: E501
"""Cat - a model defined in OpenAPI
openapi_types = {
'declawed': 'bool'
}
Args:
class_name (str):
validations = {
}
Keyword Args: # noqa: E501
declawed (bool): [optional] # noqa: E501
color (str): [optional] if omitted the server will use the default value of 'red' # noqa: E501
"""
def __init__(self, declawed=None): # noqa: E501
"""Cat - a model defined in OpenAPI""" # noqa: E501
self._declawed = None
self.discriminator = None
if declawed is not None:
self.declawed = declawed # noqa: E501
self.declawed = (
declawed
)
@property
def declawed(self):
@ -70,9 +84,7 @@ class Cat(object):
return self._declawed
@declawed.setter
def declawed(
self,
declawed):
def declawed(self, declawed): # noqa: E501
"""Sets the declawed of this Cat.
@ -81,7 +93,8 @@ class Cat(object):
"""
self._declawed = (
declawed)
declawed
)
def to_dict(self):
"""Returns the model properties as a dict"""

View File

@ -10,48 +10,68 @@
"""
import pprint
import pprint # noqa: F401
import re # noqa: F401
import six
import six # noqa: F401
from petstore_api.exceptions import ApiValueError # noqa: F401
from petstore_api.model_utils import ( # noqa: F401
ModelNormal,
ModelSimple,
check_allowed_values,
check_validations
)
class CatAllOf(object):
class CatAllOf(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
discriminator_value_class_map (dict): A dict to go from the discriminator
variable value to the discriminator class name.
openapi_types (dict): The key is attribute name
and the value is attribute type.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
"""
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
openapi_types = {
'declawed': 'bool',
allowed_values = {
}
attribute_map = {
'declawed': 'declawed', # noqa: E501
'declawed': 'declawed' # noqa: E501
}
openapi_types = {
'declawed': 'bool'
}
validations = {
}
def __init__(self, declawed=None): # noqa: E501
"""CatAllOf - a model defined in OpenAPI
Keyword Args:
declawed (bool): [optional] # noqa: E501
"""
"""CatAllOf - a model defined in OpenAPI""" # noqa: E501
self._declawed = None
self.discriminator = None
if declawed is not None:
self.declawed = declawed # noqa: E501
self.declawed = (
declawed
)
@property
def declawed(self):
@ -64,9 +84,7 @@ class CatAllOf(object):
return self._declawed
@declawed.setter
def declawed(
self,
declawed):
def declawed(self, declawed): # noqa: E501
"""Sets the declawed of this CatAllOf.
@ -75,7 +93,8 @@ class CatAllOf(object):
"""
self._declawed = (
declawed)
declawed
)
def to_dict(self):
"""Returns the model properties as a dict"""

View File

@ -10,52 +10,71 @@
"""
import pprint
import pprint # noqa: F401
import re # noqa: F401
import six
import six # noqa: F401
from petstore_api.exceptions import ApiValueError # noqa: F401
from petstore_api.model_utils import ( # noqa: F401
ModelNormal,
ModelSimple,
check_allowed_values,
check_validations
)
class Category(object):
class Category(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
discriminator_value_class_map (dict): A dict to go from the discriminator
variable value to the discriminator class name.
openapi_types (dict): The key is attribute name
and the value is attribute type.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
"""
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
openapi_types = {
'name': 'str',
'id': 'int',
allowed_values = {
}
attribute_map = {
'name': 'name', # noqa: E501
'id': 'id', # noqa: E501
'name': 'name' # noqa: E501
}
def __init__(self, name='default-name', id=None): # noqa: E501
"""Category - a model defined in OpenAPI
openapi_types = {
'id': 'int',
'name': 'str'
}
Args:
validations = {
}
Keyword Args:
name (str): defaults to 'default-name', must be one of ['default-name'] # noqa: E501
id (int): [optional] # noqa: E501
"""
def __init__(self, id=None, name='default-name'): # noqa: E501
"""Category - a model defined in OpenAPI""" # noqa: E501
self._id = None
self._name = None
self.discriminator = None
if id is not None:
self.id = id # noqa: E501
self.id = (
id
)
self.name = name
@property
@ -69,9 +88,7 @@ class Category(object):
return self._id
@id.setter
def id(
self,
id):
def id(self, id): # noqa: E501
"""Sets the id of this Category.
@ -80,7 +97,8 @@ class Category(object):
"""
self._id = (
id)
id
)
@property
def name(self):
@ -93,9 +111,7 @@ class Category(object):
return self._name
@name.setter
def name(
self,
name):
def name(self, name): # noqa: E501
"""Sets the name of this Category.
@ -103,10 +119,11 @@ class Category(object):
:type: str
"""
if name is None:
raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501
raise ApiValueError("Invalid value for `name`, must not be `None`") # noqa: E501
self._name = (
name)
name
)
def to_dict(self):
"""Returns the model properties as a dict"""

View File

@ -10,48 +10,68 @@
"""
import pprint
import pprint # noqa: F401
import re # noqa: F401
import six
import six # noqa: F401
from petstore_api.exceptions import ApiValueError # noqa: F401
from petstore_api.model_utils import ( # noqa: F401
ModelNormal,
ModelSimple,
check_allowed_values,
check_validations
)
class ClassModel(object):
class ClassModel(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
discriminator_value_class_map (dict): A dict to go from the discriminator
variable value to the discriminator class name.
openapi_types (dict): The key is attribute name
and the value is attribute type.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
"""
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
openapi_types = {
'_class': 'str',
allowed_values = {
}
attribute_map = {
'_class': '_class', # noqa: E501
'_class': '_class' # noqa: E501
}
openapi_types = {
'_class': 'str'
}
validations = {
}
def __init__(self, _class=None): # noqa: E501
"""ClassModel - a model defined in OpenAPI
Keyword Args:
_class (str): [optional] # noqa: E501
"""
"""ClassModel - a model defined in OpenAPI""" # noqa: E501
self.__class = None
self.discriminator = None
if _class is not None:
self._class = _class # noqa: E501
self._class = (
_class
)
@property
def _class(self):
@ -64,9 +84,7 @@ class ClassModel(object):
return self.__class
@_class.setter
def _class(
self,
_class):
def _class(self, _class): # noqa: E501
"""Sets the _class of this ClassModel.
@ -75,7 +93,8 @@ class ClassModel(object):
"""
self.__class = (
_class)
_class
)
def to_dict(self):
"""Returns the model properties as a dict"""

View File

@ -10,48 +10,68 @@
"""
import pprint
import pprint # noqa: F401
import re # noqa: F401
import six
import six # noqa: F401
from petstore_api.exceptions import ApiValueError # noqa: F401
from petstore_api.model_utils import ( # noqa: F401
ModelNormal,
ModelSimple,
check_allowed_values,
check_validations
)
class Client(object):
class Client(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
discriminator_value_class_map (dict): A dict to go from the discriminator
variable value to the discriminator class name.
openapi_types (dict): The key is attribute name
and the value is attribute type.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
"""
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
openapi_types = {
'client': 'str',
allowed_values = {
}
attribute_map = {
'client': 'client', # noqa: E501
'client': 'client' # noqa: E501
}
openapi_types = {
'client': 'str'
}
validations = {
}
def __init__(self, client=None): # noqa: E501
"""Client - a model defined in OpenAPI
Keyword Args:
client (str): [optional] # noqa: E501
"""
"""Client - a model defined in OpenAPI""" # noqa: E501
self._client = None
self.discriminator = None
if client is not None:
self.client = client # noqa: E501
self.client = (
client
)
@property
def client(self):
@ -64,9 +84,7 @@ class Client(object):
return self._client
@client.setter
def client(
self,
client):
def client(self, client): # noqa: E501
"""Sets the client of this Client.
@ -75,7 +93,8 @@ class Client(object):
"""
self._client = (
client)
client
)
def to_dict(self):
"""Returns the model properties as a dict"""

View File

@ -10,54 +10,68 @@
"""
import pprint
import pprint # noqa: F401
import re # noqa: F401
import six
import six # noqa: F401
from petstore_api.exceptions import ApiValueError # noqa: F401
from petstore_api.model_utils import ( # noqa: F401
ModelNormal,
ModelSimple,
check_allowed_values,
check_validations
)
class Dog(object):
class Dog(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
discriminator_value_class_map (dict): A dict to go from the discriminator
variable value to the discriminator class name.
openapi_types (dict): The key is attribute name
and the value is attribute type.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
"""
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
openapi_types = {
'class_name': 'str',
'breed': 'str',
'color': 'str',
allowed_values = {
}
attribute_map = {
'class_name': 'className', # noqa: E501
'breed': 'breed', # noqa: E501
'color': 'color', # noqa: E501
'breed': 'breed' # noqa: E501
}
def __init__(self, class_name, breed=None, color=None): # noqa: E501
"""Dog - a model defined in OpenAPI
openapi_types = {
'breed': 'str'
}
Args:
class_name (str):
validations = {
}
Keyword Args: # noqa: E501
breed (str): [optional] # noqa: E501
color (str): [optional] if omitted the server will use the default value of 'red' # noqa: E501
"""
def __init__(self, breed=None): # noqa: E501
"""Dog - a model defined in OpenAPI""" # noqa: E501
self._breed = None
self.discriminator = None
if breed is not None:
self.breed = breed # noqa: E501
self.breed = (
breed
)
@property
def breed(self):
@ -70,9 +84,7 @@ class Dog(object):
return self._breed
@breed.setter
def breed(
self,
breed):
def breed(self, breed): # noqa: E501
"""Sets the breed of this Dog.
@ -81,7 +93,8 @@ class Dog(object):
"""
self._breed = (
breed)
breed
)
def to_dict(self):
"""Returns the model properties as a dict"""

View File

@ -10,48 +10,68 @@
"""
import pprint
import pprint # noqa: F401
import re # noqa: F401
import six
import six # noqa: F401
from petstore_api.exceptions import ApiValueError # noqa: F401
from petstore_api.model_utils import ( # noqa: F401
ModelNormal,
ModelSimple,
check_allowed_values,
check_validations
)
class DogAllOf(object):
class DogAllOf(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
discriminator_value_class_map (dict): A dict to go from the discriminator
variable value to the discriminator class name.
openapi_types (dict): The key is attribute name
and the value is attribute type.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
"""
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
openapi_types = {
'breed': 'str',
allowed_values = {
}
attribute_map = {
'breed': 'breed', # noqa: E501
'breed': 'breed' # noqa: E501
}
openapi_types = {
'breed': 'str'
}
validations = {
}
def __init__(self, breed=None): # noqa: E501
"""DogAllOf - a model defined in OpenAPI
Keyword Args:
breed (str): [optional] # noqa: E501
"""
"""DogAllOf - a model defined in OpenAPI""" # noqa: E501
self._breed = None
self.discriminator = None
if breed is not None:
self.breed = breed # noqa: E501
self.breed = (
breed
)
@property
def breed(self):
@ -64,9 +84,7 @@ class DogAllOf(object):
return self._breed
@breed.setter
def breed(
self,
breed):
def breed(self, breed): # noqa: E501
"""Sets the breed of this DogAllOf.
@ -75,7 +93,8 @@ class DogAllOf(object):
"""
self._breed = (
breed)
breed
)
def to_dict(self):
"""Returns the model properties as a dict"""

View File

@ -10,54 +10,83 @@
"""
import pprint
import pprint # noqa: F401
import re # noqa: F401
import six
import six # noqa: F401
from petstore_api.exceptions import ApiValueError # noqa: F401
from petstore_api.model_utils import ( # noqa: F401
ModelNormal,
ModelSimple,
check_allowed_values,
check_validations
)
class EnumArrays(object):
class EnumArrays(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
discriminator_value_class_map (dict): A dict to go from the discriminator
variable value to the discriminator class name.
openapi_types (dict): The key is attribute name
and the value is attribute type.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
"""
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
openapi_types = {
'just_symbol': 'str',
'array_enum': 'list[str]',
allowed_values = {
('just_symbol',): {
'&gt;&#x3D;': ">=",
'$': "$"
},
('array_enum',): {
'FISH': "fish",
'CRAB': "crab"
},
}
attribute_map = {
'just_symbol': 'just_symbol', # noqa: E501
'array_enum': 'array_enum', # noqa: E501
'array_enum': 'array_enum' # noqa: E501
}
openapi_types = {
'just_symbol': 'str',
'array_enum': 'list[str]'
}
validations = {
}
def __init__(self, just_symbol=None, array_enum=None): # noqa: E501
"""EnumArrays - a model defined in OpenAPI
Keyword Args:
just_symbol (str): [optional] # noqa: E501
array_enum (list[str]): [optional] # noqa: E501
"""
"""EnumArrays - a model defined in OpenAPI""" # noqa: E501
self._just_symbol = None
self._array_enum = None
self.discriminator = None
if just_symbol is not None:
self.just_symbol = just_symbol # noqa: E501
self.just_symbol = (
just_symbol
)
if array_enum is not None:
self.array_enum = array_enum # noqa: E501
self.array_enum = (
array_enum
)
@property
def just_symbol(self):
@ -70,24 +99,23 @@ class EnumArrays(object):
return self._just_symbol
@just_symbol.setter
def just_symbol(
self,
just_symbol):
def just_symbol(self, just_symbol): # noqa: E501
"""Sets the just_symbol of this EnumArrays.
:param just_symbol: The just_symbol of this EnumArrays. # noqa: E501
:type: str
"""
allowed_values = [">=", "$"] # noqa: E501
if just_symbol not in allowed_values:
raise ValueError(
"Invalid value for `just_symbol` ({0}), must be one of {1}" # noqa: E501
.format(just_symbol, allowed_values)
)
check_allowed_values(
self.allowed_values,
('just_symbol',),
just_symbol,
self.validations
)
self._just_symbol = (
just_symbol)
just_symbol
)
@property
def array_enum(self):
@ -100,25 +128,23 @@ class EnumArrays(object):
return self._array_enum
@array_enum.setter
def array_enum(
self,
array_enum):
def array_enum(self, array_enum): # noqa: E501
"""Sets the array_enum of this EnumArrays.
:param array_enum: The array_enum of this EnumArrays. # noqa: E501
:type: list[str]
"""
allowed_values = ["fish", "crab"] # noqa: E501
if not set(array_enum).issubset(set(allowed_values)):
raise ValueError(
"Invalid values for `array_enum` [{0}], must be a subset of [{1}]" # noqa: E501
.format(", ".join(map(str, set(array_enum) - set(allowed_values))), # noqa: E501
", ".join(map(str, allowed_values)))
)
check_allowed_values(
self.allowed_values,
('array_enum',),
array_enum,
self.validations
)
self._array_enum = (
array_enum)
array_enum
)
def to_dict(self):
"""Returns the model properties as a dict"""

View File

@ -10,75 +10,97 @@
"""
import pprint
import pprint # noqa: F401
import re # noqa: F401
import six
import six # noqa: F401
from petstore_api.exceptions import ApiValueError # noqa: F401
from petstore_api.model_utils import ( # noqa: F401
ModelNormal,
ModelSimple,
check_allowed_values,
check_validations
)
class EnumClass(object):
class EnumClass(ModelSimple):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
"""
"""
allowed enum values
"""
_ABC = "_abc"
_EFG = "-efg"
_XYZ_ = "(xyz)"
"""
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
and the value is attribute type.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
"""
allowed_values = {
('value',): {
'_ABC': "_abc",
'-EFG': "-efg",
'(XYZ)': "(xyz)"
},
}
openapi_types = {
'value': 'str'
}
attribute_map = {
validations = {
}
def __init__(self): # noqa: E501
"""EnumClass - a model defined in OpenAPI
def __init__(self, value='-efg'): # noqa: E501
"""EnumClass - a model defined in OpenAPI""" # noqa: E501
Keyword Args:
"""
self._value = None
self.discriminator = None
def to_dict(self):
"""Returns the model properties as a dict"""
result = {}
self.value = value
for attr, _ in six.iteritems(self.openapi_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict") else item,
value.items()
))
else:
result[attr] = value
@property
def value(self):
"""Gets the value of this EnumClass. # noqa: E501
return result
:return: The value of this EnumClass. # noqa: E501
:rtype: str
"""
return self._value
@value.setter
def value(self, value): # noqa: E501
"""Sets the value of this EnumClass.
:param value: The value of this EnumClass. # noqa: E501
:type: str
"""
if value is None:
raise ApiValueError("Invalid value for `value`, must not be `None`") # noqa: E501
check_allowed_values(
self.allowed_values,
('value',),
value,
self.validations
)
self._value = (
value
)
def to_str(self):
"""Returns the string representation of the model"""
return pprint.pformat(self.to_dict())
return str(self._value)
def __repr__(self):
"""For `print` and `pprint`"""

View File

@ -10,54 +10,86 @@
"""
import pprint
import pprint # noqa: F401
import re # noqa: F401
import six
import six # noqa: F401
from petstore_api.exceptions import ApiValueError # noqa: F401
from petstore_api.model_utils import ( # noqa: F401
ModelNormal,
ModelSimple,
check_allowed_values,
check_validations
)
class EnumTest(object):
class EnumTest(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
discriminator_value_class_map (dict): A dict to go from the discriminator
variable value to the discriminator class name.
openapi_types (dict): The key is attribute name
and the value is attribute type.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
"""
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
openapi_types = {
'enum_string_required': 'str',
'enum_string': 'str',
'enum_integer': 'int',
'enum_number': 'float',
'outer_enum': 'OuterEnum',
allowed_values = {
('enum_string',): {
'UPPER': "UPPER",
'LOWER': "lower",
'EMPTY': ""
},
('enum_string_required',): {
'UPPER': "UPPER",
'LOWER': "lower",
'EMPTY': ""
},
('enum_integer',): {
'1': 1,
'-1': -1
},
('enum_number',): {
'1.1': 1.1,
'-1.2': -1.2
},
}
attribute_map = {
'enum_string_required': 'enum_string_required', # noqa: E501
'enum_string': 'enum_string', # noqa: E501
'enum_string_required': 'enum_string_required', # noqa: E501
'enum_integer': 'enum_integer', # noqa: E501
'enum_number': 'enum_number', # noqa: E501
'outer_enum': 'outerEnum', # noqa: E501
'outer_enum': 'outerEnum' # noqa: E501
}
def __init__(self, enum_string_required, enum_string=None, enum_integer=None, enum_number=None, outer_enum=None): # noqa: E501
"""EnumTest - a model defined in OpenAPI
openapi_types = {
'enum_string': 'str',
'enum_string_required': 'str',
'enum_integer': 'int',
'enum_number': 'float',
'outer_enum': 'OuterEnum'
}
Args:
enum_string_required (str):
validations = {
}
Keyword Args: # noqa: E501
enum_string (str): [optional] # noqa: E501
enum_integer (int): [optional] # noqa: E501
enum_number (float): [optional] # noqa: E501
outer_enum (OuterEnum): [optional] # noqa: E501
"""
def __init__(self, enum_string=None, enum_string_required=None, enum_integer=None, enum_number=None, outer_enum=None): # noqa: E501
"""EnumTest - a model defined in OpenAPI""" # noqa: E501
self._enum_string = None
self._enum_string_required = None
@ -67,14 +99,22 @@ class EnumTest(object):
self.discriminator = None
if enum_string is not None:
self.enum_string = enum_string # noqa: E501
self.enum_string = (
enum_string
)
self.enum_string_required = enum_string_required
if enum_integer is not None:
self.enum_integer = enum_integer # noqa: E501
self.enum_integer = (
enum_integer
)
if enum_number is not None:
self.enum_number = enum_number # noqa: E501
self.enum_number = (
enum_number
)
if outer_enum is not None:
self.outer_enum = outer_enum # noqa: E501
self.outer_enum = (
outer_enum
)
@property
def enum_string(self):
@ -87,24 +127,23 @@ class EnumTest(object):
return self._enum_string
@enum_string.setter
def enum_string(
self,
enum_string):
def enum_string(self, enum_string): # noqa: E501
"""Sets the enum_string of this EnumTest.
:param enum_string: The enum_string of this EnumTest. # noqa: E501
:type: str
"""
allowed_values = ["UPPER", "lower", ""] # noqa: E501
if enum_string not in allowed_values:
raise ValueError(
"Invalid value for `enum_string` ({0}), must be one of {1}" # noqa: E501
.format(enum_string, allowed_values)
)
check_allowed_values(
self.allowed_values,
('enum_string',),
enum_string,
self.validations
)
self._enum_string = (
enum_string)
enum_string
)
@property
def enum_string_required(self):
@ -117,9 +156,7 @@ class EnumTest(object):
return self._enum_string_required
@enum_string_required.setter
def enum_string_required(
self,
enum_string_required):
def enum_string_required(self, enum_string_required): # noqa: E501
"""Sets the enum_string_required of this EnumTest.
@ -127,16 +164,17 @@ class EnumTest(object):
:type: str
"""
if enum_string_required is None:
raise ValueError("Invalid value for `enum_string_required`, must not be `None`") # noqa: E501
allowed_values = ["UPPER", "lower", ""] # noqa: E501
if enum_string_required not in allowed_values:
raise ValueError(
"Invalid value for `enum_string_required` ({0}), must be one of {1}" # noqa: E501
.format(enum_string_required, allowed_values)
)
raise ApiValueError("Invalid value for `enum_string_required`, must not be `None`") # noqa: E501
check_allowed_values(
self.allowed_values,
('enum_string_required',),
enum_string_required,
self.validations
)
self._enum_string_required = (
enum_string_required)
enum_string_required
)
@property
def enum_integer(self):
@ -149,24 +187,23 @@ class EnumTest(object):
return self._enum_integer
@enum_integer.setter
def enum_integer(
self,
enum_integer):
def enum_integer(self, enum_integer): # noqa: E501
"""Sets the enum_integer of this EnumTest.
:param enum_integer: The enum_integer of this EnumTest. # noqa: E501
:type: int
"""
allowed_values = [1, -1] # noqa: E501
if enum_integer not in allowed_values:
raise ValueError(
"Invalid value for `enum_integer` ({0}), must be one of {1}" # noqa: E501
.format(enum_integer, allowed_values)
)
check_allowed_values(
self.allowed_values,
('enum_integer',),
enum_integer,
self.validations
)
self._enum_integer = (
enum_integer)
enum_integer
)
@property
def enum_number(self):
@ -179,24 +216,23 @@ class EnumTest(object):
return self._enum_number
@enum_number.setter
def enum_number(
self,
enum_number):
def enum_number(self, enum_number): # noqa: E501
"""Sets the enum_number of this EnumTest.
:param enum_number: The enum_number of this EnumTest. # noqa: E501
:type: float
"""
allowed_values = [1.1, -1.2] # noqa: E501
if enum_number not in allowed_values:
raise ValueError(
"Invalid value for `enum_number` ({0}), must be one of {1}" # noqa: E501
.format(enum_number, allowed_values)
)
check_allowed_values(
self.allowed_values,
('enum_number',),
enum_number,
self.validations
)
self._enum_number = (
enum_number)
enum_number
)
@property
def outer_enum(self):
@ -209,9 +245,7 @@ class EnumTest(object):
return self._outer_enum
@outer_enum.setter
def outer_enum(
self,
outer_enum):
def outer_enum(self, outer_enum): # noqa: E501
"""Sets the outer_enum of this EnumTest.
@ -220,7 +254,8 @@ class EnumTest(object):
"""
self._outer_enum = (
outer_enum)
outer_enum
)
def to_dict(self):
"""Returns the model properties as a dict"""

View File

@ -10,48 +10,68 @@
"""
import pprint
import pprint # noqa: F401
import re # noqa: F401
import six
import six # noqa: F401
from petstore_api.exceptions import ApiValueError # noqa: F401
from petstore_api.model_utils import ( # noqa: F401
ModelNormal,
ModelSimple,
check_allowed_values,
check_validations
)
class File(object):
class File(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
discriminator_value_class_map (dict): A dict to go from the discriminator
variable value to the discriminator class name.
openapi_types (dict): The key is attribute name
and the value is attribute type.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
"""
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
openapi_types = {
'source_uri': 'str',
allowed_values = {
}
attribute_map = {
'source_uri': 'sourceURI', # noqa: E501
'source_uri': 'sourceURI' # noqa: E501
}
openapi_types = {
'source_uri': 'str'
}
validations = {
}
def __init__(self, source_uri=None): # noqa: E501
"""File - a model defined in OpenAPI
Keyword Args:
source_uri (str): Test capitalization. [optional] # noqa: E501
"""
"""File - a model defined in OpenAPI""" # noqa: E501
self._source_uri = None
self.discriminator = None
if source_uri is not None:
self.source_uri = source_uri # noqa: E501
self.source_uri = (
source_uri
)
@property
def source_uri(self):
@ -65,9 +85,7 @@ class File(object):
return self._source_uri
@source_uri.setter
def source_uri(
self,
source_uri):
def source_uri(self, source_uri): # noqa: E501
"""Sets the source_uri of this File.
Test capitalization # noqa: E501
@ -77,7 +95,8 @@ class File(object):
"""
self._source_uri = (
source_uri)
source_uri
)
def to_dict(self):
"""Returns the model properties as a dict"""

View File

@ -10,54 +10,75 @@
"""
import pprint
import pprint # noqa: F401
import re # noqa: F401
import six
import six # noqa: F401
from petstore_api.exceptions import ApiValueError # noqa: F401
from petstore_api.model_utils import ( # noqa: F401
ModelNormal,
ModelSimple,
check_allowed_values,
check_validations
)
class FileSchemaTestClass(object):
class FileSchemaTestClass(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
discriminator_value_class_map (dict): A dict to go from the discriminator
variable value to the discriminator class name.
openapi_types (dict): The key is attribute name
and the value is attribute type.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
"""
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
openapi_types = {
'file': 'File',
'files': 'list[File]',
allowed_values = {
}
attribute_map = {
'file': 'file', # noqa: E501
'files': 'files', # noqa: E501
'files': 'files' # noqa: E501
}
openapi_types = {
'file': 'File',
'files': 'list[File]'
}
validations = {
}
def __init__(self, file=None, files=None): # noqa: E501
"""FileSchemaTestClass - a model defined in OpenAPI
Keyword Args:
file (File): [optional] # noqa: E501
files (list[File]): [optional] # noqa: E501
"""
"""FileSchemaTestClass - a model defined in OpenAPI""" # noqa: E501
self._file = None
self._files = None
self.discriminator = None
if file is not None:
self.file = file # noqa: E501
self.file = (
file
)
if files is not None:
self.files = files # noqa: E501
self.files = (
files
)
@property
def file(self):
@ -70,9 +91,7 @@ class FileSchemaTestClass(object):
return self._file
@file.setter
def file(
self,
file):
def file(self, file): # noqa: E501
"""Sets the file of this FileSchemaTestClass.
@ -81,7 +100,8 @@ class FileSchemaTestClass(object):
"""
self._file = (
file)
file
)
@property
def files(self):
@ -94,9 +114,7 @@ class FileSchemaTestClass(object):
return self._files
@files.setter
def files(
self,
files):
def files(self, files): # noqa: E501
"""Sets the files of this FileSchemaTestClass.
@ -105,7 +123,8 @@ class FileSchemaTestClass(object):
"""
self._files = (
files)
files
)
def to_dict(self):
"""Returns the model properties as a dict"""

View File

@ -10,78 +10,126 @@
"""
import pprint
import pprint # noqa: F401
import re # noqa: F401
import six
import six # noqa: F401
from petstore_api.exceptions import ApiValueError # noqa: F401
from petstore_api.model_utils import ( # noqa: F401
ModelNormal,
ModelSimple,
check_allowed_values,
check_validations
)
class FormatTest(object):
class FormatTest(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
discriminator_value_class_map (dict): A dict to go from the discriminator
variable value to the discriminator class name.
openapi_types (dict): The key is attribute name
and the value is attribute type.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
"""
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
openapi_types = {
'number': 'float',
'byte': 'str',
'date': 'date',
'password': 'str',
'integer': 'int',
'int32': 'int',
'int64': 'int',
'float': 'float',
'double': 'float',
'string': 'str',
'binary': 'file',
'date_time': 'datetime',
'uuid': 'str',
allowed_values = {
}
attribute_map = {
'number': 'number', # noqa: E501
'byte': 'byte', # noqa: E501
'date': 'date', # noqa: E501
'password': 'password', # noqa: E501
'integer': 'integer', # noqa: E501
'int32': 'int32', # noqa: E501
'int64': 'int64', # noqa: E501
'number': 'number', # noqa: E501
'float': 'float', # noqa: E501
'double': 'double', # noqa: E501
'string': 'string', # noqa: E501
'byte': 'byte', # noqa: E501
'binary': 'binary', # noqa: E501
'date': 'date', # noqa: E501
'date_time': 'dateTime', # noqa: E501
'uuid': 'uuid', # noqa: E501
'password': 'password' # noqa: E501
}
def __init__(self, number, byte, date, password, integer=None, int32=None, int64=None, float=None, double=None, string=None, binary=None, date_time=None, uuid=None): # noqa: E501
"""FormatTest - a model defined in OpenAPI
openapi_types = {
'integer': 'int',
'int32': 'int',
'int64': 'int',
'number': 'float',
'float': 'float',
'double': 'float',
'string': 'str',
'byte': 'str',
'binary': 'file',
'date': 'date',
'date_time': 'datetime',
'uuid': 'str',
'password': 'str'
}
Args:
number (float):
byte (str):
date (date):
password (str):
validations = {
('integer',): {
Keyword Args: # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501
integer (int): [optional] # noqa: E501
int32 (int): [optional] # noqa: E501
int64 (int): [optional] # noqa: E501
float (float): [optional] # noqa: E501
double (float): [optional] # noqa: E501
string (str): [optional] # noqa: E501
binary (file): [optional] # noqa: E501
date_time (datetime): [optional] # noqa: E501
uuid (str): [optional] # noqa: E501
"""
'inclusive_maximum': 100,
'inclusive_minimum': 10,
},
('int32',): {
'inclusive_maximum': 200,
'inclusive_minimum': 20,
},
('number',): {
'inclusive_maximum': 543.2,
'inclusive_minimum': 32.1,
},
('float',): {
'inclusive_maximum': 987.6,
'inclusive_minimum': 54.3,
},
('double',): {
'inclusive_maximum': 123.4,
'inclusive_minimum': 67.8,
},
('string',): {
'regex': {
'pattern': r'^[a-z]+$', # noqa: E501
'flags': (re.IGNORECASE)
},
},
('byte',): {
'regex': {
'pattern': r'^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$', # noqa: E501
},
},
('password',): {
'max_length': 64,
'min_length': 10,
},
}
def __init__(self, integer=None, int32=None, int64=None, number=None, float=None, double=None, string=None, byte=None, binary=None, date=None, date_time=None, uuid=None, password=None): # noqa: E501
"""FormatTest - a model defined in OpenAPI""" # noqa: E501
self._integer = None
self._int32 = None
@ -99,26 +147,44 @@ class FormatTest(object):
self.discriminator = None
if integer is not None:
self.integer = integer # noqa: E501
self.integer = (
integer
)
if int32 is not None:
self.int32 = int32 # noqa: E501
self.int32 = (
int32
)
if int64 is not None:
self.int64 = int64 # noqa: E501
self.int64 = (
int64
)
self.number = number
if float is not None:
self.float = float # noqa: E501
self.float = (
float
)
if double is not None:
self.double = double # noqa: E501
self.double = (
double
)
if string is not None:
self.string = string # noqa: E501
self.string = (
string
)
self.byte = byte
if binary is not None:
self.binary = binary # noqa: E501
self.binary = (
binary
)
self.date = date
if date_time is not None:
self.date_time = date_time # noqa: E501
self.date_time = (
date_time
)
if uuid is not None:
self.uuid = uuid # noqa: E501
self.uuid = (
uuid
)
self.password = password
@property
@ -132,22 +198,22 @@ class FormatTest(object):
return self._integer
@integer.setter
def integer(
self,
integer):
def integer(self, integer): # noqa: E501
"""Sets the integer of this FormatTest.
:param integer: The integer of this FormatTest. # noqa: E501
:type: int
"""
if integer is not None and integer > 100: # noqa: E501
raise ValueError("Invalid value for `integer`, must be a value less than or equal to `100`") # noqa: E501
if integer is not None and integer < 10: # noqa: E501
raise ValueError("Invalid value for `integer`, must be a value greater than or equal to `10`") # noqa: E501
check_validations(
self.validations,
('integer',),
integer
)
self._integer = (
integer)
integer
)
@property
def int32(self):
@ -160,22 +226,22 @@ class FormatTest(object):
return self._int32
@int32.setter
def int32(
self,
int32):
def int32(self, int32): # noqa: E501
"""Sets the int32 of this FormatTest.
:param int32: The int32 of this FormatTest. # noqa: E501
:type: int
"""
if int32 is not None and int32 > 200: # noqa: E501
raise ValueError("Invalid value for `int32`, must be a value less than or equal to `200`") # noqa: E501
if int32 is not None and int32 < 20: # noqa: E501
raise ValueError("Invalid value for `int32`, must be a value greater than or equal to `20`") # noqa: E501
check_validations(
self.validations,
('int32',),
int32
)
self._int32 = (
int32)
int32
)
@property
def int64(self):
@ -188,9 +254,7 @@ class FormatTest(object):
return self._int64
@int64.setter
def int64(
self,
int64):
def int64(self, int64): # noqa: E501
"""Sets the int64 of this FormatTest.
@ -199,7 +263,8 @@ class FormatTest(object):
"""
self._int64 = (
int64)
int64
)
@property
def number(self):
@ -212,9 +277,7 @@ class FormatTest(object):
return self._number
@number.setter
def number(
self,
number):
def number(self, number): # noqa: E501
"""Sets the number of this FormatTest.
@ -222,14 +285,16 @@ class FormatTest(object):
:type: float
"""
if number is None:
raise ValueError("Invalid value for `number`, must not be `None`") # noqa: E501
if number is not None and number > 543.2: # noqa: E501
raise ValueError("Invalid value for `number`, must be a value less than or equal to `543.2`") # noqa: E501
if number is not None and number < 32.1: # noqa: E501
raise ValueError("Invalid value for `number`, must be a value greater than or equal to `32.1`") # noqa: E501
raise ApiValueError("Invalid value for `number`, must not be `None`") # noqa: E501
check_validations(
self.validations,
('number',),
number
)
self._number = (
number)
number
)
@property
def float(self):
@ -242,22 +307,22 @@ class FormatTest(object):
return self._float
@float.setter
def float(
self,
float):
def float(self, float): # noqa: E501
"""Sets the float of this FormatTest.
:param float: The float of this FormatTest. # noqa: E501
:type: float
"""
if float is not None and float > 987.6: # noqa: E501
raise ValueError("Invalid value for `float`, must be a value less than or equal to `987.6`") # noqa: E501
if float is not None and float < 54.3: # noqa: E501
raise ValueError("Invalid value for `float`, must be a value greater than or equal to `54.3`") # noqa: E501
check_validations(
self.validations,
('float',),
float
)
self._float = (
float)
float
)
@property
def double(self):
@ -270,22 +335,22 @@ class FormatTest(object):
return self._double
@double.setter
def double(
self,
double):
def double(self, double): # noqa: E501
"""Sets the double of this FormatTest.
:param double: The double of this FormatTest. # noqa: E501
:type: float
"""
if double is not None and double > 123.4: # noqa: E501
raise ValueError("Invalid value for `double`, must be a value less than or equal to `123.4`") # noqa: E501
if double is not None and double < 67.8: # noqa: E501
raise ValueError("Invalid value for `double`, must be a value greater than or equal to `67.8`") # noqa: E501
check_validations(
self.validations,
('double',),
double
)
self._double = (
double)
double
)
@property
def string(self):
@ -298,20 +363,22 @@ class FormatTest(object):
return self._string
@string.setter
def string(
self,
string):
def string(self, string): # noqa: E501
"""Sets the string of this FormatTest.
:param string: The string of this FormatTest. # noqa: E501
:type: str
"""
if string is not None and not re.search(r'[a-z]', string, flags=re.IGNORECASE): # noqa: E501
raise ValueError(r"Invalid value for `string`, must be a follow pattern or equal to `/[a-z]/i`") # noqa: E501
check_validations(
self.validations,
('string',),
string
)
self._string = (
string)
string
)
@property
def byte(self):
@ -324,9 +391,7 @@ class FormatTest(object):
return self._byte
@byte.setter
def byte(
self,
byte):
def byte(self, byte): # noqa: E501
"""Sets the byte of this FormatTest.
@ -334,12 +399,16 @@ class FormatTest(object):
:type: str
"""
if byte is None:
raise ValueError("Invalid value for `byte`, must not be `None`") # noqa: E501
if byte is not None and not re.search(r'^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$', byte): # noqa: E501
raise ValueError(r"Invalid value for `byte`, must be a follow pattern or equal to `/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/`") # noqa: E501
raise ApiValueError("Invalid value for `byte`, must not be `None`") # noqa: E501
check_validations(
self.validations,
('byte',),
byte
)
self._byte = (
byte)
byte
)
@property
def binary(self):
@ -352,9 +421,7 @@ class FormatTest(object):
return self._binary
@binary.setter
def binary(
self,
binary):
def binary(self, binary): # noqa: E501
"""Sets the binary of this FormatTest.
@ -363,7 +430,8 @@ class FormatTest(object):
"""
self._binary = (
binary)
binary
)
@property
def date(self):
@ -376,9 +444,7 @@ class FormatTest(object):
return self._date
@date.setter
def date(
self,
date):
def date(self, date): # noqa: E501
"""Sets the date of this FormatTest.
@ -386,10 +452,11 @@ class FormatTest(object):
:type: date
"""
if date is None:
raise ValueError("Invalid value for `date`, must not be `None`") # noqa: E501
raise ApiValueError("Invalid value for `date`, must not be `None`") # noqa: E501
self._date = (
date)
date
)
@property
def date_time(self):
@ -402,9 +469,7 @@ class FormatTest(object):
return self._date_time
@date_time.setter
def date_time(
self,
date_time):
def date_time(self, date_time): # noqa: E501
"""Sets the date_time of this FormatTest.
@ -413,7 +478,8 @@ class FormatTest(object):
"""
self._date_time = (
date_time)
date_time
)
@property
def uuid(self):
@ -426,9 +492,7 @@ class FormatTest(object):
return self._uuid
@uuid.setter
def uuid(
self,
uuid):
def uuid(self, uuid): # noqa: E501
"""Sets the uuid of this FormatTest.
@ -437,7 +501,8 @@ class FormatTest(object):
"""
self._uuid = (
uuid)
uuid
)
@property
def password(self):
@ -450,9 +515,7 @@ class FormatTest(object):
return self._password
@password.setter
def password(
self,
password):
def password(self, password): # noqa: E501
"""Sets the password of this FormatTest.
@ -460,14 +523,16 @@ class FormatTest(object):
:type: str
"""
if password is None:
raise ValueError("Invalid value for `password`, must not be `None`") # noqa: E501
if password is not None and len(password) > 64:
raise ValueError("Invalid value for `password`, length must be less than or equal to `64`") # noqa: E501
if password is not None and len(password) < 10:
raise ValueError("Invalid value for `password`, length must be greater than or equal to `10`") # noqa: E501
raise ApiValueError("Invalid value for `password`, must not be `None`") # noqa: E501
check_validations(
self.validations,
('password',),
password
)
self._password = (
password)
password
)
def to_dict(self):
"""Returns the model properties as a dict"""

View File

@ -10,54 +10,75 @@
"""
import pprint
import pprint # noqa: F401
import re # noqa: F401
import six
import six # noqa: F401
from petstore_api.exceptions import ApiValueError # noqa: F401
from petstore_api.model_utils import ( # noqa: F401
ModelNormal,
ModelSimple,
check_allowed_values,
check_validations
)
class HasOnlyReadOnly(object):
class HasOnlyReadOnly(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
discriminator_value_class_map (dict): A dict to go from the discriminator
variable value to the discriminator class name.
openapi_types (dict): The key is attribute name
and the value is attribute type.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
"""
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
openapi_types = {
'bar': 'str',
'foo': 'str',
allowed_values = {
}
attribute_map = {
'bar': 'bar', # noqa: E501
'foo': 'foo', # noqa: E501
'foo': 'foo' # noqa: E501
}
openapi_types = {
'bar': 'str',
'foo': 'str'
}
validations = {
}
def __init__(self, bar=None, foo=None): # noqa: E501
"""HasOnlyReadOnly - a model defined in OpenAPI
Keyword Args:
bar (str): [optional] # noqa: E501
foo (str): [optional] # noqa: E501
"""
"""HasOnlyReadOnly - a model defined in OpenAPI""" # noqa: E501
self._bar = None
self._foo = None
self.discriminator = None
if bar is not None:
self.bar = bar # noqa: E501
self.bar = (
bar
)
if foo is not None:
self.foo = foo # noqa: E501
self.foo = (
foo
)
@property
def bar(self):
@ -70,9 +91,7 @@ class HasOnlyReadOnly(object):
return self._bar
@bar.setter
def bar(
self,
bar):
def bar(self, bar): # noqa: E501
"""Sets the bar of this HasOnlyReadOnly.
@ -81,7 +100,8 @@ class HasOnlyReadOnly(object):
"""
self._bar = (
bar)
bar
)
@property
def foo(self):
@ -94,9 +114,7 @@ class HasOnlyReadOnly(object):
return self._foo
@foo.setter
def foo(
self,
foo):
def foo(self, foo): # noqa: E501
"""Sets the foo of this HasOnlyReadOnly.
@ -105,7 +123,8 @@ class HasOnlyReadOnly(object):
"""
self._foo = (
foo)
foo
)
def to_dict(self):
"""Returns the model properties as a dict"""

View File

@ -10,48 +10,68 @@
"""
import pprint
import pprint # noqa: F401
import re # noqa: F401
import six
import six # noqa: F401
from petstore_api.exceptions import ApiValueError # noqa: F401
from petstore_api.model_utils import ( # noqa: F401
ModelNormal,
ModelSimple,
check_allowed_values,
check_validations
)
class List(object):
class List(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
discriminator_value_class_map (dict): A dict to go from the discriminator
variable value to the discriminator class name.
openapi_types (dict): The key is attribute name
and the value is attribute type.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
"""
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
openapi_types = {
'_123_list': 'str',
allowed_values = {
}
attribute_map = {
'_123_list': '123-list', # noqa: E501
'_123_list': '123-list' # noqa: E501
}
openapi_types = {
'_123_list': 'str'
}
validations = {
}
def __init__(self, _123_list=None): # noqa: E501
"""List - a model defined in OpenAPI
Keyword Args:
_123_list (str): [optional] # noqa: E501
"""
"""List - a model defined in OpenAPI""" # noqa: E501
self.__123_list = None
self.discriminator = None
if _123_list is not None:
self._123_list = _123_list # noqa: E501
self._123_list = (
_123_list
)
@property
def _123_list(self):
@ -64,9 +84,7 @@ class List(object):
return self.__123_list
@_123_list.setter
def _123_list(
self,
_123_list):
def _123_list(self, _123_list): # noqa: E501
"""Sets the _123_list of this List.
@ -75,7 +93,8 @@ class List(object):
"""
self.__123_list = (
_123_list)
_123_list
)
def to_dict(self):
"""Returns the model properties as a dict"""

View File

@ -10,51 +10,70 @@
"""
import pprint
import pprint # noqa: F401
import re # noqa: F401
import six
import six # noqa: F401
from petstore_api.exceptions import ApiValueError # noqa: F401
from petstore_api.model_utils import ( # noqa: F401
ModelNormal,
ModelSimple,
check_allowed_values,
check_validations
)
class MapTest(object):
class MapTest(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
discriminator_value_class_map (dict): A dict to go from the discriminator
variable value to the discriminator class name.
openapi_types (dict): The key is attribute name
and the value is attribute type.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
"""
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
openapi_types = {
'map_map_of_string': 'dict(str, dict(str, str))',
'map_of_enum_string': 'dict(str, str)',
'direct_map': 'dict(str, bool)',
'indirect_map': 'dict(str, bool)',
allowed_values = {
('map_of_enum_string',): {
'UPPER': "UPPER",
'LOWER': "lower"
},
}
attribute_map = {
'map_map_of_string': 'map_map_of_string', # noqa: E501
'map_of_enum_string': 'map_of_enum_string', # noqa: E501
'direct_map': 'direct_map', # noqa: E501
'indirect_map': 'indirect_map', # noqa: E501
'indirect_map': 'indirect_map' # noqa: E501
}
openapi_types = {
'map_map_of_string': 'dict(str, dict(str, str))',
'map_of_enum_string': 'dict(str, str)',
'direct_map': 'dict(str, bool)',
'indirect_map': 'StringBooleanMap'
}
validations = {
}
def __init__(self, map_map_of_string=None, map_of_enum_string=None, direct_map=None, indirect_map=None): # noqa: E501
"""MapTest - a model defined in OpenAPI
Keyword Args:
map_map_of_string (dict(str, dict(str, str))): [optional] # noqa: E501
map_of_enum_string (dict(str, str)): [optional] # noqa: E501
direct_map (dict(str, bool)): [optional] # noqa: E501
indirect_map (dict(str, bool)): [optional] # noqa: E501
"""
"""MapTest - a model defined in OpenAPI""" # noqa: E501
self._map_map_of_string = None
self._map_of_enum_string = None
@ -63,13 +82,21 @@ class MapTest(object):
self.discriminator = None
if map_map_of_string is not None:
self.map_map_of_string = map_map_of_string # noqa: E501
self.map_map_of_string = (
map_map_of_string
)
if map_of_enum_string is not None:
self.map_of_enum_string = map_of_enum_string # noqa: E501
self.map_of_enum_string = (
map_of_enum_string
)
if direct_map is not None:
self.direct_map = direct_map # noqa: E501
self.direct_map = (
direct_map
)
if indirect_map is not None:
self.indirect_map = indirect_map # noqa: E501
self.indirect_map = (
indirect_map
)
@property
def map_map_of_string(self):
@ -82,9 +109,7 @@ class MapTest(object):
return self._map_map_of_string
@map_map_of_string.setter
def map_map_of_string(
self,
map_map_of_string):
def map_map_of_string(self, map_map_of_string): # noqa: E501
"""Sets the map_map_of_string of this MapTest.
@ -93,7 +118,8 @@ class MapTest(object):
"""
self._map_map_of_string = (
map_map_of_string)
map_map_of_string
)
@property
def map_of_enum_string(self):
@ -106,25 +132,23 @@ class MapTest(object):
return self._map_of_enum_string
@map_of_enum_string.setter
def map_of_enum_string(
self,
map_of_enum_string):
def map_of_enum_string(self, map_of_enum_string): # noqa: E501
"""Sets the map_of_enum_string of this MapTest.
:param map_of_enum_string: The map_of_enum_string of this MapTest. # noqa: E501
:type: dict(str, str)
"""
allowed_values = ["UPPER", "lower"] # noqa: E501
if not set(map_of_enum_string.keys()).issubset(set(allowed_values)):
raise ValueError(
"Invalid keys in `map_of_enum_string` [{0}], must be a subset of [{1}]" # noqa: E501
.format(", ".join(map(str, set(map_of_enum_string.keys()) - set(allowed_values))), # noqa: E501
", ".join(map(str, allowed_values)))
)
check_allowed_values(
self.allowed_values,
('map_of_enum_string',),
map_of_enum_string,
self.validations
)
self._map_of_enum_string = (
map_of_enum_string)
map_of_enum_string
)
@property
def direct_map(self):
@ -137,9 +161,7 @@ class MapTest(object):
return self._direct_map
@direct_map.setter
def direct_map(
self,
direct_map):
def direct_map(self, direct_map): # noqa: E501
"""Sets the direct_map of this MapTest.
@ -148,7 +170,8 @@ class MapTest(object):
"""
self._direct_map = (
direct_map)
direct_map
)
@property
def indirect_map(self):
@ -156,23 +179,22 @@ class MapTest(object):
:return: The indirect_map of this MapTest. # noqa: E501
:rtype: dict(str, bool)
:rtype: StringBooleanMap
"""
return self._indirect_map
@indirect_map.setter
def indirect_map(
self,
indirect_map):
def indirect_map(self, indirect_map): # noqa: E501
"""Sets the indirect_map of this MapTest.
:param indirect_map: The indirect_map of this MapTest. # noqa: E501
:type: dict(str, bool)
:type: StringBooleanMap
"""
self._indirect_map = (
indirect_map)
indirect_map
)
def to_dict(self):
"""Returns the model properties as a dict"""

View File

@ -10,48 +10,64 @@
"""
import pprint
import pprint # noqa: F401
import re # noqa: F401
import six
import six # noqa: F401
from petstore_api.exceptions import ApiValueError # noqa: F401
from petstore_api.model_utils import ( # noqa: F401
ModelNormal,
ModelSimple,
check_allowed_values,
check_validations
)
class MixedPropertiesAndAdditionalPropertiesClass(object):
class MixedPropertiesAndAdditionalPropertiesClass(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
discriminator_value_class_map (dict): A dict to go from the discriminator
variable value to the discriminator class name.
openapi_types (dict): The key is attribute name
and the value is attribute type.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
"""
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
openapi_types = {
'uuid': 'str',
'date_time': 'datetime',
'map': 'dict(str, Animal)',
allowed_values = {
}
attribute_map = {
'uuid': 'uuid', # noqa: E501
'date_time': 'dateTime', # noqa: E501
'map': 'map', # noqa: E501
'map': 'map' # noqa: E501
}
openapi_types = {
'uuid': 'str',
'date_time': 'datetime',
'map': 'dict(str, Animal)'
}
validations = {
}
def __init__(self, uuid=None, date_time=None, map=None): # noqa: E501
"""MixedPropertiesAndAdditionalPropertiesClass - a model defined in OpenAPI
Keyword Args:
uuid (str): [optional] # noqa: E501
date_time (datetime): [optional] # noqa: E501
map (dict(str, Animal)): [optional] # noqa: E501
"""
"""MixedPropertiesAndAdditionalPropertiesClass - a model defined in OpenAPI""" # noqa: E501
self._uuid = None
self._date_time = None
@ -59,11 +75,17 @@ class MixedPropertiesAndAdditionalPropertiesClass(object):
self.discriminator = None
if uuid is not None:
self.uuid = uuid # noqa: E501
self.uuid = (
uuid
)
if date_time is not None:
self.date_time = date_time # noqa: E501
self.date_time = (
date_time
)
if map is not None:
self.map = map # noqa: E501
self.map = (
map
)
@property
def uuid(self):
@ -76,9 +98,7 @@ class MixedPropertiesAndAdditionalPropertiesClass(object):
return self._uuid
@uuid.setter
def uuid(
self,
uuid):
def uuid(self, uuid): # noqa: E501
"""Sets the uuid of this MixedPropertiesAndAdditionalPropertiesClass.
@ -87,7 +107,8 @@ class MixedPropertiesAndAdditionalPropertiesClass(object):
"""
self._uuid = (
uuid)
uuid
)
@property
def date_time(self):
@ -100,9 +121,7 @@ class MixedPropertiesAndAdditionalPropertiesClass(object):
return self._date_time
@date_time.setter
def date_time(
self,
date_time):
def date_time(self, date_time): # noqa: E501
"""Sets the date_time of this MixedPropertiesAndAdditionalPropertiesClass.
@ -111,7 +130,8 @@ class MixedPropertiesAndAdditionalPropertiesClass(object):
"""
self._date_time = (
date_time)
date_time
)
@property
def map(self):
@ -124,9 +144,7 @@ class MixedPropertiesAndAdditionalPropertiesClass(object):
return self._map
@map.setter
def map(
self,
map):
def map(self, map): # noqa: E501
"""Sets the map of this MixedPropertiesAndAdditionalPropertiesClass.
@ -135,7 +153,8 @@ class MixedPropertiesAndAdditionalPropertiesClass(object):
"""
self._map = (
map)
map
)
def to_dict(self):
"""Returns the model properties as a dict"""

View File

@ -10,54 +10,75 @@
"""
import pprint
import pprint # noqa: F401
import re # noqa: F401
import six
import six # noqa: F401
from petstore_api.exceptions import ApiValueError # noqa: F401
from petstore_api.model_utils import ( # noqa: F401
ModelNormal,
ModelSimple,
check_allowed_values,
check_validations
)
class Model200Response(object):
class Model200Response(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
discriminator_value_class_map (dict): A dict to go from the discriminator
variable value to the discriminator class name.
openapi_types (dict): The key is attribute name
and the value is attribute type.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
"""
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
openapi_types = {
'name': 'int',
'_class': 'str',
allowed_values = {
}
attribute_map = {
'name': 'name', # noqa: E501
'_class': 'class', # noqa: E501
'_class': 'class' # noqa: E501
}
openapi_types = {
'name': 'int',
'_class': 'str'
}
validations = {
}
def __init__(self, name=None, _class=None): # noqa: E501
"""Model200Response - a model defined in OpenAPI
Keyword Args:
name (int): [optional] # noqa: E501
_class (str): [optional] # noqa: E501
"""
"""Model200Response - a model defined in OpenAPI""" # noqa: E501
self._name = None
self.__class = None
self.discriminator = None
if name is not None:
self.name = name # noqa: E501
self.name = (
name
)
if _class is not None:
self._class = _class # noqa: E501
self._class = (
_class
)
@property
def name(self):
@ -70,9 +91,7 @@ class Model200Response(object):
return self._name
@name.setter
def name(
self,
name):
def name(self, name): # noqa: E501
"""Sets the name of this Model200Response.
@ -81,7 +100,8 @@ class Model200Response(object):
"""
self._name = (
name)
name
)
@property
def _class(self):
@ -94,9 +114,7 @@ class Model200Response(object):
return self.__class
@_class.setter
def _class(
self,
_class):
def _class(self, _class): # noqa: E501
"""Sets the _class of this Model200Response.
@ -105,7 +123,8 @@ class Model200Response(object):
"""
self.__class = (
_class)
_class
)
def to_dict(self):
"""Returns the model properties as a dict"""

View File

@ -10,48 +10,68 @@
"""
import pprint
import pprint # noqa: F401
import re # noqa: F401
import six
import six # noqa: F401
from petstore_api.exceptions import ApiValueError # noqa: F401
from petstore_api.model_utils import ( # noqa: F401
ModelNormal,
ModelSimple,
check_allowed_values,
check_validations
)
class ModelReturn(object):
class ModelReturn(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
discriminator_value_class_map (dict): A dict to go from the discriminator
variable value to the discriminator class name.
openapi_types (dict): The key is attribute name
and the value is attribute type.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
"""
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
openapi_types = {
'_return': 'int',
allowed_values = {
}
attribute_map = {
'_return': 'return', # noqa: E501
'_return': 'return' # noqa: E501
}
openapi_types = {
'_return': 'int'
}
validations = {
}
def __init__(self, _return=None): # noqa: E501
"""ModelReturn - a model defined in OpenAPI
Keyword Args:
_return (int): [optional] # noqa: E501
"""
"""ModelReturn - a model defined in OpenAPI""" # noqa: E501
self.__return = None
self.discriminator = None
if _return is not None:
self._return = _return # noqa: E501
self._return = (
_return
)
@property
def _return(self):
@ -64,9 +84,7 @@ class ModelReturn(object):
return self.__return
@_return.setter
def _return(
self,
_return):
def _return(self, _return): # noqa: E501
"""Sets the _return of this ModelReturn.
@ -75,7 +93,8 @@ class ModelReturn(object):
"""
self.__return = (
_return)
_return
)
def to_dict(self):
"""Returns the model properties as a dict"""

View File

@ -10,51 +10,66 @@
"""
import pprint
import pprint # noqa: F401
import re # noqa: F401
import six
import six # noqa: F401
from petstore_api.exceptions import ApiValueError # noqa: F401
from petstore_api.model_utils import ( # noqa: F401
ModelNormal,
ModelSimple,
check_allowed_values,
check_validations
)
class Name(object):
class Name(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
discriminator_value_class_map (dict): A dict to go from the discriminator
variable value to the discriminator class name.
openapi_types (dict): The key is attribute name
and the value is attribute type.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
"""
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
openapi_types = {
'name': 'int',
'snake_case': 'int',
'_property': 'str',
'_123_number': 'int',
allowed_values = {
}
attribute_map = {
'name': 'name', # noqa: E501
'snake_case': 'snake_case', # noqa: E501
'_property': 'property', # noqa: E501
'_123_number': '123Number', # noqa: E501
'_123_number': '123Number' # noqa: E501
}
def __init__(self, name, snake_case=None, _property=None, _123_number=None): # noqa: E501
"""Name - a model defined in OpenAPI
openapi_types = {
'name': 'int',
'snake_case': 'int',
'_property': 'str',
'_123_number': 'int'
}
Args:
name (int):
validations = {
}
Keyword Args: # noqa: E501
snake_case (int): [optional] # noqa: E501
_property (str): [optional] # noqa: E501
_123_number (int): [optional] # noqa: E501
"""
def __init__(self, name=None, snake_case=None, _property=None, _123_number=None): # noqa: E501
"""Name - a model defined in OpenAPI""" # noqa: E501
self._name = None
self._snake_case = None
@ -64,11 +79,17 @@ class Name(object):
self.name = name
if snake_case is not None:
self.snake_case = snake_case # noqa: E501
self.snake_case = (
snake_case
)
if _property is not None:
self._property = _property # noqa: E501
self._property = (
_property
)
if _123_number is not None:
self._123_number = _123_number # noqa: E501
self._123_number = (
_123_number
)
@property
def name(self):
@ -81,9 +102,7 @@ class Name(object):
return self._name
@name.setter
def name(
self,
name):
def name(self, name): # noqa: E501
"""Sets the name of this Name.
@ -91,10 +110,11 @@ class Name(object):
:type: int
"""
if name is None:
raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501
raise ApiValueError("Invalid value for `name`, must not be `None`") # noqa: E501
self._name = (
name)
name
)
@property
def snake_case(self):
@ -107,9 +127,7 @@ class Name(object):
return self._snake_case
@snake_case.setter
def snake_case(
self,
snake_case):
def snake_case(self, snake_case): # noqa: E501
"""Sets the snake_case of this Name.
@ -118,7 +136,8 @@ class Name(object):
"""
self._snake_case = (
snake_case)
snake_case
)
@property
def _property(self):
@ -131,9 +150,7 @@ class Name(object):
return self.__property
@_property.setter
def _property(
self,
_property):
def _property(self, _property): # noqa: E501
"""Sets the _property of this Name.
@ -142,7 +159,8 @@ class Name(object):
"""
self.__property = (
_property)
_property
)
@property
def _123_number(self):
@ -155,9 +173,7 @@ class Name(object):
return self.__123_number
@_123_number.setter
def _123_number(
self,
_123_number):
def _123_number(self, _123_number): # noqa: E501
"""Sets the _123_number of this Name.
@ -166,7 +182,8 @@ class Name(object):
"""
self.__123_number = (
_123_number)
_123_number
)
def to_dict(self):
"""Returns the model properties as a dict"""

View File

@ -10,48 +10,68 @@
"""
import pprint
import pprint # noqa: F401
import re # noqa: F401
import six
import six # noqa: F401
from petstore_api.exceptions import ApiValueError # noqa: F401
from petstore_api.model_utils import ( # noqa: F401
ModelNormal,
ModelSimple,
check_allowed_values,
check_validations
)
class NumberOnly(object):
class NumberOnly(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
discriminator_value_class_map (dict): A dict to go from the discriminator
variable value to the discriminator class name.
openapi_types (dict): The key is attribute name
and the value is attribute type.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
"""
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
openapi_types = {
'just_number': 'float',
allowed_values = {
}
attribute_map = {
'just_number': 'JustNumber', # noqa: E501
'just_number': 'JustNumber' # noqa: E501
}
openapi_types = {
'just_number': 'float'
}
validations = {
}
def __init__(self, just_number=None): # noqa: E501
"""NumberOnly - a model defined in OpenAPI
Keyword Args:
just_number (float): [optional] # noqa: E501
"""
"""NumberOnly - a model defined in OpenAPI""" # noqa: E501
self._just_number = None
self.discriminator = None
if just_number is not None:
self.just_number = just_number # noqa: E501
self.just_number = (
just_number
)
@property
def just_number(self):
@ -64,9 +84,7 @@ class NumberOnly(object):
return self._just_number
@just_number.setter
def just_number(
self,
just_number):
def just_number(self, just_number): # noqa: E501
"""Sets the just_number of this NumberOnly.
@ -75,7 +93,8 @@ class NumberOnly(object):
"""
self._just_number = (
just_number)
just_number
)
def to_dict(self):
"""Returns the model properties as a dict"""

View File

@ -10,33 +10,50 @@
"""
import pprint
import pprint # noqa: F401
import re # noqa: F401
import six
import six # noqa: F401
from petstore_api.exceptions import ApiValueError # noqa: F401
from petstore_api.model_utils import ( # noqa: F401
ModelNormal,
ModelSimple,
check_allowed_values,
check_validations
)
class Order(object):
class Order(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
discriminator_value_class_map (dict): A dict to go from the discriminator
variable value to the discriminator class name.
openapi_types (dict): The key is attribute name
and the value is attribute type.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
"""
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
openapi_types = {
'id': 'int',
'pet_id': 'int',
'quantity': 'int',
'ship_date': 'datetime',
'status': 'str',
'complete': 'bool',
allowed_values = {
('status',): {
'PLACED': "placed",
'APPROVED': "approved",
'DELIVERED': "delivered"
},
}
attribute_map = {
@ -45,22 +62,23 @@ class Order(object):
'quantity': 'quantity', # noqa: E501
'ship_date': 'shipDate', # noqa: E501
'status': 'status', # noqa: E501
'complete': 'complete', # noqa: E501
'complete': 'complete' # noqa: E501
}
def __init__(self, id=None, pet_id=None, quantity=None, ship_date=None, status=None, complete=None): # noqa: E501
"""Order - a model defined in OpenAPI
openapi_types = {
'id': 'int',
'pet_id': 'int',
'quantity': 'int',
'ship_date': 'datetime',
'status': 'str',
'complete': 'bool'
}
validations = {
}
Keyword Args:
id (int): [optional] # noqa: E501
pet_id (int): [optional] # noqa: E501
quantity (int): [optional] # noqa: E501
ship_date (datetime): [optional] # noqa: E501
status (str): Order Status. [optional] # noqa: E501
complete (bool): [optional] if omitted the server will use the default value of False # noqa: E501
"""
def __init__(self, id=None, pet_id=None, quantity=None, ship_date=None, status=None, complete=False): # noqa: E501
"""Order - a model defined in OpenAPI""" # noqa: E501
self._id = None
self._pet_id = None
@ -71,17 +89,29 @@ class Order(object):
self.discriminator = None
if id is not None:
self.id = id # noqa: E501
self.id = (
id
)
if pet_id is not None:
self.pet_id = pet_id # noqa: E501
self.pet_id = (
pet_id
)
if quantity is not None:
self.quantity = quantity # noqa: E501
self.quantity = (
quantity
)
if ship_date is not None:
self.ship_date = ship_date # noqa: E501
self.ship_date = (
ship_date
)
if status is not None:
self.status = status # noqa: E501
self.status = (
status
)
if complete is not None:
self.complete = complete # noqa: E501
self.complete = (
complete
)
@property
def id(self):
@ -94,9 +124,7 @@ class Order(object):
return self._id
@id.setter
def id(
self,
id):
def id(self, id): # noqa: E501
"""Sets the id of this Order.
@ -105,7 +133,8 @@ class Order(object):
"""
self._id = (
id)
id
)
@property
def pet_id(self):
@ -118,9 +147,7 @@ class Order(object):
return self._pet_id
@pet_id.setter
def pet_id(
self,
pet_id):
def pet_id(self, pet_id): # noqa: E501
"""Sets the pet_id of this Order.
@ -129,7 +156,8 @@ class Order(object):
"""
self._pet_id = (
pet_id)
pet_id
)
@property
def quantity(self):
@ -142,9 +170,7 @@ class Order(object):
return self._quantity
@quantity.setter
def quantity(
self,
quantity):
def quantity(self, quantity): # noqa: E501
"""Sets the quantity of this Order.
@ -153,7 +179,8 @@ class Order(object):
"""
self._quantity = (
quantity)
quantity
)
@property
def ship_date(self):
@ -166,9 +193,7 @@ class Order(object):
return self._ship_date
@ship_date.setter
def ship_date(
self,
ship_date):
def ship_date(self, ship_date): # noqa: E501
"""Sets the ship_date of this Order.
@ -177,7 +202,8 @@ class Order(object):
"""
self._ship_date = (
ship_date)
ship_date
)
@property
def status(self):
@ -191,9 +217,7 @@ class Order(object):
return self._status
@status.setter
def status(
self,
status):
def status(self, status): # noqa: E501
"""Sets the status of this Order.
Order Status # noqa: E501
@ -201,15 +225,16 @@ class Order(object):
:param status: The status of this Order. # noqa: E501
:type: str
"""
allowed_values = ["placed", "approved", "delivered"] # noqa: E501
if status not in allowed_values:
raise ValueError(
"Invalid value for `status` ({0}), must be one of {1}" # noqa: E501
.format(status, allowed_values)
)
check_allowed_values(
self.allowed_values,
('status',),
status,
self.validations
)
self._status = (
status)
status
)
@property
def complete(self):
@ -222,9 +247,7 @@ class Order(object):
return self._complete
@complete.setter
def complete(
self,
complete):
def complete(self, complete): # noqa: E501
"""Sets the complete of this Order.
@ -233,7 +256,8 @@ class Order(object):
"""
self._complete = (
complete)
complete
)
def to_dict(self):
"""Returns the model properties as a dict"""

View File

@ -10,48 +10,64 @@
"""
import pprint
import pprint # noqa: F401
import re # noqa: F401
import six
import six # noqa: F401
from petstore_api.exceptions import ApiValueError # noqa: F401
from petstore_api.model_utils import ( # noqa: F401
ModelNormal,
ModelSimple,
check_allowed_values,
check_validations
)
class OuterComposite(object):
class OuterComposite(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
discriminator_value_class_map (dict): A dict to go from the discriminator
variable value to the discriminator class name.
openapi_types (dict): The key is attribute name
and the value is attribute type.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
"""
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
openapi_types = {
'my_number': 'float',
'my_string': 'str',
'my_boolean': 'bool',
allowed_values = {
}
attribute_map = {
'my_number': 'my_number', # noqa: E501
'my_string': 'my_string', # noqa: E501
'my_boolean': 'my_boolean', # noqa: E501
'my_boolean': 'my_boolean' # noqa: E501
}
openapi_types = {
'my_number': 'OuterNumber',
'my_string': 'str',
'my_boolean': 'bool'
}
validations = {
}
def __init__(self, my_number=None, my_string=None, my_boolean=None): # noqa: E501
"""OuterComposite - a model defined in OpenAPI
Keyword Args:
my_number (float): [optional] # noqa: E501
my_string (str): [optional] # noqa: E501
my_boolean (bool): [optional] # noqa: E501
"""
"""OuterComposite - a model defined in OpenAPI""" # noqa: E501
self._my_number = None
self._my_string = None
@ -59,11 +75,17 @@ class OuterComposite(object):
self.discriminator = None
if my_number is not None:
self.my_number = my_number # noqa: E501
self.my_number = (
my_number
)
if my_string is not None:
self.my_string = my_string # noqa: E501
self.my_string = (
my_string
)
if my_boolean is not None:
self.my_boolean = my_boolean # noqa: E501
self.my_boolean = (
my_boolean
)
@property
def my_number(self):
@ -71,23 +93,22 @@ class OuterComposite(object):
:return: The my_number of this OuterComposite. # noqa: E501
:rtype: float
:rtype: OuterNumber
"""
return self._my_number
@my_number.setter
def my_number(
self,
my_number):
def my_number(self, my_number): # noqa: E501
"""Sets the my_number of this OuterComposite.
:param my_number: The my_number of this OuterComposite. # noqa: E501
:type: float
:type: OuterNumber
"""
self._my_number = (
my_number)
my_number
)
@property
def my_string(self):
@ -100,9 +121,7 @@ class OuterComposite(object):
return self._my_string
@my_string.setter
def my_string(
self,
my_string):
def my_string(self, my_string): # noqa: E501
"""Sets the my_string of this OuterComposite.
@ -111,7 +130,8 @@ class OuterComposite(object):
"""
self._my_string = (
my_string)
my_string
)
@property
def my_boolean(self):
@ -124,9 +144,7 @@ class OuterComposite(object):
return self._my_boolean
@my_boolean.setter
def my_boolean(
self,
my_boolean):
def my_boolean(self, my_boolean): # noqa: E501
"""Sets the my_boolean of this OuterComposite.
@ -135,7 +153,8 @@ class OuterComposite(object):
"""
self._my_boolean = (
my_boolean)
my_boolean
)
def to_dict(self):
"""Returns the model properties as a dict"""

View File

@ -10,75 +10,97 @@
"""
import pprint
import pprint # noqa: F401
import re # noqa: F401
import six
import six # noqa: F401
from petstore_api.exceptions import ApiValueError # noqa: F401
from petstore_api.model_utils import ( # noqa: F401
ModelNormal,
ModelSimple,
check_allowed_values,
check_validations
)
class OuterEnum(object):
class OuterEnum(ModelSimple):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
"""
"""
allowed enum values
"""
PLACED = "placed"
APPROVED = "approved"
DELIVERED = "delivered"
"""
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
and the value is attribute type.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
"""
allowed_values = {
('value',): {
'PLACED': "placed",
'APPROVED': "approved",
'DELIVERED': "delivered"
},
}
openapi_types = {
'value': 'str'
}
attribute_map = {
validations = {
}
def __init__(self): # noqa: E501
"""OuterEnum - a model defined in OpenAPI
def __init__(self, value=None): # noqa: E501
"""OuterEnum - a model defined in OpenAPI""" # noqa: E501
Keyword Args:
"""
self._value = None
self.discriminator = None
def to_dict(self):
"""Returns the model properties as a dict"""
result = {}
self.value = value
for attr, _ in six.iteritems(self.openapi_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict") else item,
value.items()
))
else:
result[attr] = value
@property
def value(self):
"""Gets the value of this OuterEnum. # noqa: E501
return result
:return: The value of this OuterEnum. # noqa: E501
:rtype: str
"""
return self._value
@value.setter
def value(self, value): # noqa: E501
"""Sets the value of this OuterEnum.
:param value: The value of this OuterEnum. # noqa: E501
:type: str
"""
if value is None:
raise ApiValueError("Invalid value for `value`, must not be `None`") # noqa: E501
check_allowed_values(
self.allowed_values,
('value',),
value,
self.validations
)
self._value = (
value
)
def to_str(self):
"""Returns the string representation of the model"""
return pprint.pformat(self.to_dict())
return str(self._value)
def __repr__(self):
"""For `print` and `pprint`"""

View File

@ -0,0 +1,117 @@
# coding: utf-8
"""
OpenAPI Petstore
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
"""
import pprint # noqa: F401
import re # noqa: F401
import six # noqa: F401
from petstore_api.exceptions import ApiValueError # noqa: F401
from petstore_api.model_utils import ( # noqa: F401
ModelNormal,
ModelSimple,
check_allowed_values,
check_validations
)
class OuterNumber(ModelSimple):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
openapi_types (dict): The key is attribute name
and the value is attribute type.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
"""
allowed_values = {
}
openapi_types = {
'value': 'float'
}
validations = {
('value',): {
'inclusive_maximum': 2E+1,
'inclusive_minimum': 1E+1,
},
}
def __init__(self, value=None): # noqa: E501
"""OuterNumber - a model defined in OpenAPI""" # noqa: E501
self._value = None
self.discriminator = None
self.value = value
@property
def value(self):
"""Gets the value of this OuterNumber. # noqa: E501
:return: The value of this OuterNumber. # noqa: E501
:rtype: float
"""
return self._value
@value.setter
def value(self, value): # noqa: E501
"""Sets the value of this OuterNumber.
:param value: The value of this OuterNumber. # noqa: E501
:type: float
"""
if value is None:
raise ApiValueError("Invalid value for `value`, must not be `None`") # noqa: E501
check_validations(
self.validations,
('value',),
value
)
self._value = (
value
)
def to_str(self):
"""Returns the string representation of the model"""
return str(self._value)
def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str()
def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, OuterNumber):
return False
return self.__dict__ == other.__dict__
def __ne__(self, other):
"""Returns true if both objects are not equal"""
return not self == other

View File

@ -10,57 +10,75 @@
"""
import pprint
import pprint # noqa: F401
import re # noqa: F401
import six
import six # noqa: F401
from petstore_api.exceptions import ApiValueError # noqa: F401
from petstore_api.model_utils import ( # noqa: F401
ModelNormal,
ModelSimple,
check_allowed_values,
check_validations
)
class Pet(object):
class Pet(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
discriminator_value_class_map (dict): A dict to go from the discriminator
variable value to the discriminator class name.
openapi_types (dict): The key is attribute name
and the value is attribute type.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
"""
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
openapi_types = {
'name': 'str',
'photo_urls': 'list[str]',
'id': 'int',
'category': 'Category',
'tags': 'list[Tag]',
'status': 'str',
allowed_values = {
('status',): {
'AVAILABLE': "available",
'PENDING': "pending",
'SOLD': "sold"
},
}
attribute_map = {
'name': 'name', # noqa: E501
'photo_urls': 'photoUrls', # noqa: E501
'id': 'id', # noqa: E501
'category': 'category', # noqa: E501
'name': 'name', # noqa: E501
'photo_urls': 'photoUrls', # noqa: E501
'tags': 'tags', # noqa: E501
'status': 'status', # noqa: E501
'status': 'status' # noqa: E501
}
def __init__(self, name, photo_urls, id=None, category=None, tags=None, status=None): # noqa: E501
"""Pet - a model defined in OpenAPI
openapi_types = {
'id': 'int',
'category': 'Category',
'name': 'str',
'photo_urls': 'list[str]',
'tags': 'list[Tag]',
'status': 'str'
}
Args:
name (str):
photo_urls (list[str]):
validations = {
}
Keyword Args: # noqa: E501 # noqa: E501
id (int): [optional] # noqa: E501
category (Category): [optional] # noqa: E501
tags (list[Tag]): [optional] # noqa: E501
status (str): pet status in the store. [optional] # noqa: E501
"""
def __init__(self, id=None, category=None, name=None, photo_urls=None, tags=None, status=None): # noqa: E501
"""Pet - a model defined in OpenAPI""" # noqa: E501
self._id = None
self._category = None
@ -71,15 +89,23 @@ class Pet(object):
self.discriminator = None
if id is not None:
self.id = id # noqa: E501
self.id = (
id
)
if category is not None:
self.category = category # noqa: E501
self.category = (
category
)
self.name = name
self.photo_urls = photo_urls
if tags is not None:
self.tags = tags # noqa: E501
self.tags = (
tags
)
if status is not None:
self.status = status # noqa: E501
self.status = (
status
)
@property
def id(self):
@ -92,9 +118,7 @@ class Pet(object):
return self._id
@id.setter
def id(
self,
id):
def id(self, id): # noqa: E501
"""Sets the id of this Pet.
@ -103,7 +127,8 @@ class Pet(object):
"""
self._id = (
id)
id
)
@property
def category(self):
@ -116,9 +141,7 @@ class Pet(object):
return self._category
@category.setter
def category(
self,
category):
def category(self, category): # noqa: E501
"""Sets the category of this Pet.
@ -127,7 +150,8 @@ class Pet(object):
"""
self._category = (
category)
category
)
@property
def name(self):
@ -140,9 +164,7 @@ class Pet(object):
return self._name
@name.setter
def name(
self,
name):
def name(self, name): # noqa: E501
"""Sets the name of this Pet.
@ -150,10 +172,11 @@ class Pet(object):
:type: str
"""
if name is None:
raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501
raise ApiValueError("Invalid value for `name`, must not be `None`") # noqa: E501
self._name = (
name)
name
)
@property
def photo_urls(self):
@ -166,9 +189,7 @@ class Pet(object):
return self._photo_urls
@photo_urls.setter
def photo_urls(
self,
photo_urls):
def photo_urls(self, photo_urls): # noqa: E501
"""Sets the photo_urls of this Pet.
@ -176,10 +197,11 @@ class Pet(object):
:type: list[str]
"""
if photo_urls is None:
raise ValueError("Invalid value for `photo_urls`, must not be `None`") # noqa: E501
raise ApiValueError("Invalid value for `photo_urls`, must not be `None`") # noqa: E501
self._photo_urls = (
photo_urls)
photo_urls
)
@property
def tags(self):
@ -192,9 +214,7 @@ class Pet(object):
return self._tags
@tags.setter
def tags(
self,
tags):
def tags(self, tags): # noqa: E501
"""Sets the tags of this Pet.
@ -203,7 +223,8 @@ class Pet(object):
"""
self._tags = (
tags)
tags
)
@property
def status(self):
@ -217,9 +238,7 @@ class Pet(object):
return self._status
@status.setter
def status(
self,
status):
def status(self, status): # noqa: E501
"""Sets the status of this Pet.
pet status in the store # noqa: E501
@ -227,15 +246,16 @@ class Pet(object):
:param status: The status of this Pet. # noqa: E501
:type: str
"""
allowed_values = ["available", "pending", "sold"] # noqa: E501
if status not in allowed_values:
raise ValueError(
"Invalid value for `status` ({0}), must be one of {1}" # noqa: E501
.format(status, allowed_values)
)
check_allowed_values(
self.allowed_values,
('status',),
status,
self.validations
)
self._status = (
status)
status
)
def to_dict(self):
"""Returns the model properties as a dict"""

View File

@ -10,54 +10,75 @@
"""
import pprint
import pprint # noqa: F401
import re # noqa: F401
import six
import six # noqa: F401
from petstore_api.exceptions import ApiValueError # noqa: F401
from petstore_api.model_utils import ( # noqa: F401
ModelNormal,
ModelSimple,
check_allowed_values,
check_validations
)
class ReadOnlyFirst(object):
class ReadOnlyFirst(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
discriminator_value_class_map (dict): A dict to go from the discriminator
variable value to the discriminator class name.
openapi_types (dict): The key is attribute name
and the value is attribute type.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
"""
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
openapi_types = {
'bar': 'str',
'baz': 'str',
allowed_values = {
}
attribute_map = {
'bar': 'bar', # noqa: E501
'baz': 'baz', # noqa: E501
'baz': 'baz' # noqa: E501
}
openapi_types = {
'bar': 'str',
'baz': 'str'
}
validations = {
}
def __init__(self, bar=None, baz=None): # noqa: E501
"""ReadOnlyFirst - a model defined in OpenAPI
Keyword Args:
bar (str): [optional] # noqa: E501
baz (str): [optional] # noqa: E501
"""
"""ReadOnlyFirst - a model defined in OpenAPI""" # noqa: E501
self._bar = None
self._baz = None
self.discriminator = None
if bar is not None:
self.bar = bar # noqa: E501
self.bar = (
bar
)
if baz is not None:
self.baz = baz # noqa: E501
self.baz = (
baz
)
@property
def bar(self):
@ -70,9 +91,7 @@ class ReadOnlyFirst(object):
return self._bar
@bar.setter
def bar(
self,
bar):
def bar(self, bar): # noqa: E501
"""Sets the bar of this ReadOnlyFirst.
@ -81,7 +100,8 @@ class ReadOnlyFirst(object):
"""
self._bar = (
bar)
bar
)
@property
def baz(self):
@ -94,9 +114,7 @@ class ReadOnlyFirst(object):
return self._baz
@baz.setter
def baz(
self,
baz):
def baz(self, baz): # noqa: E501
"""Sets the baz of this ReadOnlyFirst.
@ -105,7 +123,8 @@ class ReadOnlyFirst(object):
"""
self._baz = (
baz)
baz
)
def to_dict(self):
"""Returns the model properties as a dict"""

View File

@ -10,48 +10,68 @@
"""
import pprint
import pprint # noqa: F401
import re # noqa: F401
import six
import six # noqa: F401
from petstore_api.exceptions import ApiValueError # noqa: F401
from petstore_api.model_utils import ( # noqa: F401
ModelNormal,
ModelSimple,
check_allowed_values,
check_validations
)
class SpecialModelName(object):
class SpecialModelName(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
discriminator_value_class_map (dict): A dict to go from the discriminator
variable value to the discriminator class name.
openapi_types (dict): The key is attribute name
and the value is attribute type.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
"""
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
openapi_types = {
'special_property_name': 'int',
allowed_values = {
}
attribute_map = {
'special_property_name': '$special[property.name]', # noqa: E501
'special_property_name': '$special[property.name]' # noqa: E501
}
openapi_types = {
'special_property_name': 'int'
}
validations = {
}
def __init__(self, special_property_name=None): # noqa: E501
"""SpecialModelName - a model defined in OpenAPI
Keyword Args:
special_property_name (int): [optional] # noqa: E501
"""
"""SpecialModelName - a model defined in OpenAPI""" # noqa: E501
self._special_property_name = None
self.discriminator = None
if special_property_name is not None:
self.special_property_name = special_property_name # noqa: E501
self.special_property_name = (
special_property_name
)
@property
def special_property_name(self):
@ -64,9 +84,7 @@ class SpecialModelName(object):
return self._special_property_name
@special_property_name.setter
def special_property_name(
self,
special_property_name):
def special_property_name(self, special_property_name): # noqa: E501
"""Sets the special_property_name of this SpecialModelName.
@ -75,7 +93,8 @@ class SpecialModelName(object):
"""
self._special_property_name = (
special_property_name)
special_property_name
)
def to_dict(self):
"""Returns the model properties as a dict"""

View File

@ -0,0 +1,108 @@
# coding: utf-8
"""
OpenAPI Petstore
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
"""
import pprint # noqa: F401
import re # noqa: F401
import six # noqa: F401
from petstore_api.exceptions import ApiValueError # noqa: F401
from petstore_api.model_utils import ( # noqa: F401
ModelNormal,
ModelSimple,
check_allowed_values,
check_validations
)
class StringBooleanMap(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
discriminator_value_class_map (dict): A dict to go from the discriminator
variable value to the discriminator class name.
openapi_types (dict): The key is attribute name
and the value is attribute type.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
"""
allowed_values = {
}
attribute_map = {
}
openapi_types = {
}
validations = {
}
def __init__(self): # noqa: E501
"""StringBooleanMap - a model defined in OpenAPI""" # noqa: E501
self.discriminator = None
def to_dict(self):
"""Returns the model properties as a dict"""
result = {}
for attr, _ in six.iteritems(self.openapi_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict") else item,
value.items()
))
else:
result[attr] = value
return result
def to_str(self):
"""Returns the string representation of the model"""
return pprint.pformat(self.to_dict())
def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str()
def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, StringBooleanMap):
return False
return self.__dict__ == other.__dict__
def __ne__(self, other):
"""Returns true if both objects are not equal"""
return not self == other

View File

@ -10,54 +10,75 @@
"""
import pprint
import pprint # noqa: F401
import re # noqa: F401
import six
import six # noqa: F401
from petstore_api.exceptions import ApiValueError # noqa: F401
from petstore_api.model_utils import ( # noqa: F401
ModelNormal,
ModelSimple,
check_allowed_values,
check_validations
)
class Tag(object):
class Tag(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
discriminator_value_class_map (dict): A dict to go from the discriminator
variable value to the discriminator class name.
openapi_types (dict): The key is attribute name
and the value is attribute type.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
"""
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
openapi_types = {
'id': 'int',
'name': 'str',
allowed_values = {
}
attribute_map = {
'id': 'id', # noqa: E501
'name': 'name', # noqa: E501
'name': 'name' # noqa: E501
}
openapi_types = {
'id': 'int',
'name': 'str'
}
validations = {
}
def __init__(self, id=None, name=None): # noqa: E501
"""Tag - a model defined in OpenAPI
Keyword Args:
id (int): [optional] # noqa: E501
name (str): [optional] # noqa: E501
"""
"""Tag - a model defined in OpenAPI""" # noqa: E501
self._id = None
self._name = None
self.discriminator = None
if id is not None:
self.id = id # noqa: E501
self.id = (
id
)
if name is not None:
self.name = name # noqa: E501
self.name = (
name
)
@property
def id(self):
@ -70,9 +91,7 @@ class Tag(object):
return self._id
@id.setter
def id(
self,
id):
def id(self, id): # noqa: E501
"""Sets the id of this Tag.
@ -81,7 +100,8 @@ class Tag(object):
"""
self._id = (
id)
id
)
@property
def name(self):
@ -94,9 +114,7 @@ class Tag(object):
return self._name
@name.setter
def name(
self,
name):
def name(self, name): # noqa: E501
"""Sets the name of this Tag.
@ -105,7 +123,8 @@ class Tag(object):
"""
self._name = (
name)
name
)
def to_dict(self):
"""Returns the model properties as a dict"""

View File

@ -10,34 +10,45 @@
"""
import pprint
import pprint # noqa: F401
import re # noqa: F401
import six
import six # noqa: F401
from petstore_api.exceptions import ApiValueError # noqa: F401
from petstore_api.model_utils import ( # noqa: F401
ModelNormal,
ModelSimple,
check_allowed_values,
check_validations
)
class TypeHolderDefault(object):
class TypeHolderDefault(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
discriminator_value_class_map (dict): A dict to go from the discriminator
variable value to the discriminator class name.
openapi_types (dict): The key is attribute name
and the value is attribute type.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
"""
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
openapi_types = {
'string_item': 'str',
'number_item': 'float',
'integer_item': 'int',
'bool_item': 'bool',
'array_item': 'list[int]',
'date_item': 'date',
'datetime_item': 'datetime',
allowed_values = {
}
attribute_map = {
@ -45,25 +56,26 @@ class TypeHolderDefault(object):
'number_item': 'number_item', # noqa: E501
'integer_item': 'integer_item', # noqa: E501
'bool_item': 'bool_item', # noqa: E501
'array_item': 'array_item', # noqa: E501
'date_item': 'date_item', # noqa: E501
'datetime_item': 'datetime_item', # noqa: E501
'array_item': 'array_item' # noqa: E501
}
def __init__(self, array_item, string_item='what', number_item=1.234, integer_item=-2, bool_item=True, date_item=None, datetime_item=None): # noqa: E501
"""TypeHolderDefault - a model defined in OpenAPI
openapi_types = {
'string_item': 'str',
'number_item': 'float',
'integer_item': 'int',
'bool_item': 'bool',
'date_item': 'date',
'datetime_item': 'datetime',
'array_item': 'list[int]'
}
Args:
array_item (list[int]):
validations = {
}
Keyword Args:
string_item (str): defaults to 'what', must be one of ['what'] # noqa: E501
number_item (float): defaults to 1.234, must be one of [1.234] # noqa: E501
integer_item (int): defaults to -2, must be one of [-2] # noqa: E501
bool_item (bool): defaults to True, must be one of [True] # noqa: E501 # noqa: E501
date_item (date): [optional] # noqa: E501
datetime_item (datetime): [optional] # noqa: E501
"""
def __init__(self, string_item='what', number_item=1.234, integer_item=-2, bool_item=True, date_item=None, datetime_item=None, array_item=None): # noqa: E501
"""TypeHolderDefault - a model defined in OpenAPI""" # noqa: E501
self._string_item = None
self._number_item = None
@ -79,9 +91,13 @@ class TypeHolderDefault(object):
self.integer_item = integer_item
self.bool_item = bool_item
if date_item is not None:
self.date_item = date_item # noqa: E501
self.date_item = (
date_item
)
if datetime_item is not None:
self.datetime_item = datetime_item # noqa: E501
self.datetime_item = (
datetime_item
)
self.array_item = array_item
@property
@ -95,9 +111,7 @@ class TypeHolderDefault(object):
return self._string_item
@string_item.setter
def string_item(
self,
string_item):
def string_item(self, string_item): # noqa: E501
"""Sets the string_item of this TypeHolderDefault.
@ -105,10 +119,11 @@ class TypeHolderDefault(object):
:type: str
"""
if string_item is None:
raise ValueError("Invalid value for `string_item`, must not be `None`") # noqa: E501
raise ApiValueError("Invalid value for `string_item`, must not be `None`") # noqa: E501
self._string_item = (
string_item)
string_item
)
@property
def number_item(self):
@ -121,9 +136,7 @@ class TypeHolderDefault(object):
return self._number_item
@number_item.setter
def number_item(
self,
number_item):
def number_item(self, number_item): # noqa: E501
"""Sets the number_item of this TypeHolderDefault.
@ -131,10 +144,11 @@ class TypeHolderDefault(object):
:type: float
"""
if number_item is None:
raise ValueError("Invalid value for `number_item`, must not be `None`") # noqa: E501
raise ApiValueError("Invalid value for `number_item`, must not be `None`") # noqa: E501
self._number_item = (
number_item)
number_item
)
@property
def integer_item(self):
@ -147,9 +161,7 @@ class TypeHolderDefault(object):
return self._integer_item
@integer_item.setter
def integer_item(
self,
integer_item):
def integer_item(self, integer_item): # noqa: E501
"""Sets the integer_item of this TypeHolderDefault.
@ -157,10 +169,11 @@ class TypeHolderDefault(object):
:type: int
"""
if integer_item is None:
raise ValueError("Invalid value for `integer_item`, must not be `None`") # noqa: E501
raise ApiValueError("Invalid value for `integer_item`, must not be `None`") # noqa: E501
self._integer_item = (
integer_item)
integer_item
)
@property
def bool_item(self):
@ -173,9 +186,7 @@ class TypeHolderDefault(object):
return self._bool_item
@bool_item.setter
def bool_item(
self,
bool_item):
def bool_item(self, bool_item): # noqa: E501
"""Sets the bool_item of this TypeHolderDefault.
@ -183,10 +194,11 @@ class TypeHolderDefault(object):
:type: bool
"""
if bool_item is None:
raise ValueError("Invalid value for `bool_item`, must not be `None`") # noqa: E501
raise ApiValueError("Invalid value for `bool_item`, must not be `None`") # noqa: E501
self._bool_item = (
bool_item)
bool_item
)
@property
def date_item(self):
@ -199,9 +211,7 @@ class TypeHolderDefault(object):
return self._date_item
@date_item.setter
def date_item(
self,
date_item):
def date_item(self, date_item): # noqa: E501
"""Sets the date_item of this TypeHolderDefault.
@ -210,7 +220,8 @@ class TypeHolderDefault(object):
"""
self._date_item = (
date_item)
date_item
)
@property
def datetime_item(self):
@ -223,9 +234,7 @@ class TypeHolderDefault(object):
return self._datetime_item
@datetime_item.setter
def datetime_item(
self,
datetime_item):
def datetime_item(self, datetime_item): # noqa: E501
"""Sets the datetime_item of this TypeHolderDefault.
@ -234,7 +243,8 @@ class TypeHolderDefault(object):
"""
self._datetime_item = (
datetime_item)
datetime_item
)
@property
def array_item(self):
@ -247,9 +257,7 @@ class TypeHolderDefault(object):
return self._array_item
@array_item.setter
def array_item(
self,
array_item):
def array_item(self, array_item): # noqa: E501
"""Sets the array_item of this TypeHolderDefault.
@ -257,10 +265,11 @@ class TypeHolderDefault(object):
:type: list[int]
"""
if array_item is None:
raise ValueError("Invalid value for `array_item`, must not be `None`") # noqa: E501
raise ApiValueError("Invalid value for `array_item`, must not be `None`") # noqa: E501
self._array_item = (
array_item)
array_item
)
def to_dict(self):
"""Returns the model properties as a dict"""

View File

@ -10,32 +10,54 @@
"""
import pprint
import pprint # noqa: F401
import re # noqa: F401
import six
import six # noqa: F401
from petstore_api.exceptions import ApiValueError # noqa: F401
from petstore_api.model_utils import ( # noqa: F401
ModelNormal,
ModelSimple,
check_allowed_values,
check_validations
)
class TypeHolderExample(object):
class TypeHolderExample(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
discriminator_value_class_map (dict): A dict to go from the discriminator
variable value to the discriminator class name.
openapi_types (dict): The key is attribute name
and the value is attribute type.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
"""
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
openapi_types = {
'string_item': 'str',
'number_item': 'float',
'integer_item': 'int',
'bool_item': 'bool',
'array_item': 'list[int]',
allowed_values = {
('string_item',): {
'WHAT': "what"
},
('number_item',): {
'1.234': 1.234
},
('integer_item',): {
'-2': -2
},
}
attribute_map = {
@ -43,21 +65,22 @@ class TypeHolderExample(object):
'number_item': 'number_item', # noqa: E501
'integer_item': 'integer_item', # noqa: E501
'bool_item': 'bool_item', # noqa: E501
'array_item': 'array_item', # noqa: E501
'array_item': 'array_item' # noqa: E501
}
def __init__(self, bool_item, array_item, string_item='what', number_item=1.234, integer_item=-2): # noqa: E501
"""TypeHolderExample - a model defined in OpenAPI
openapi_types = {
'string_item': 'str',
'number_item': 'float',
'integer_item': 'int',
'bool_item': 'bool',
'array_item': 'list[int]'
}
Args:
bool_item (bool):
array_item (list[int]):
validations = {
}
Keyword Args:
string_item (str): defaults to 'what', must be one of ['what'] # noqa: E501
number_item (float): defaults to 1.234, must be one of [1.234] # noqa: E501
integer_item (int): defaults to -2, must be one of [-2] # noqa: E501 # noqa: E501 # noqa: E501
"""
def __init__(self, string_item='what', number_item=1.234, integer_item=-2, bool_item=None, array_item=None): # noqa: E501
"""TypeHolderExample - a model defined in OpenAPI""" # noqa: E501
self._string_item = None
self._number_item = None
@ -83,9 +106,7 @@ class TypeHolderExample(object):
return self._string_item
@string_item.setter
def string_item(
self,
string_item):
def string_item(self, string_item): # noqa: E501
"""Sets the string_item of this TypeHolderExample.
@ -93,16 +114,17 @@ class TypeHolderExample(object):
:type: str
"""
if string_item is None:
raise ValueError("Invalid value for `string_item`, must not be `None`") # noqa: E501
allowed_values = ["what"] # noqa: E501
if string_item not in allowed_values:
raise ValueError(
"Invalid value for `string_item` ({0}), must be one of {1}" # noqa: E501
.format(string_item, allowed_values)
)
raise ApiValueError("Invalid value for `string_item`, must not be `None`") # noqa: E501
check_allowed_values(
self.allowed_values,
('string_item',),
string_item,
self.validations
)
self._string_item = (
string_item)
string_item
)
@property
def number_item(self):
@ -115,9 +137,7 @@ class TypeHolderExample(object):
return self._number_item
@number_item.setter
def number_item(
self,
number_item):
def number_item(self, number_item): # noqa: E501
"""Sets the number_item of this TypeHolderExample.
@ -125,16 +145,17 @@ class TypeHolderExample(object):
:type: float
"""
if number_item is None:
raise ValueError("Invalid value for `number_item`, must not be `None`") # noqa: E501
allowed_values = [1.234] # noqa: E501
if number_item not in allowed_values:
raise ValueError(
"Invalid value for `number_item` ({0}), must be one of {1}" # noqa: E501
.format(number_item, allowed_values)
)
raise ApiValueError("Invalid value for `number_item`, must not be `None`") # noqa: E501
check_allowed_values(
self.allowed_values,
('number_item',),
number_item,
self.validations
)
self._number_item = (
number_item)
number_item
)
@property
def integer_item(self):
@ -147,9 +168,7 @@ class TypeHolderExample(object):
return self._integer_item
@integer_item.setter
def integer_item(
self,
integer_item):
def integer_item(self, integer_item): # noqa: E501
"""Sets the integer_item of this TypeHolderExample.
@ -157,16 +176,17 @@ class TypeHolderExample(object):
:type: int
"""
if integer_item is None:
raise ValueError("Invalid value for `integer_item`, must not be `None`") # noqa: E501
allowed_values = [-2] # noqa: E501
if integer_item not in allowed_values:
raise ValueError(
"Invalid value for `integer_item` ({0}), must be one of {1}" # noqa: E501
.format(integer_item, allowed_values)
)
raise ApiValueError("Invalid value for `integer_item`, must not be `None`") # noqa: E501
check_allowed_values(
self.allowed_values,
('integer_item',),
integer_item,
self.validations
)
self._integer_item = (
integer_item)
integer_item
)
@property
def bool_item(self):
@ -179,9 +199,7 @@ class TypeHolderExample(object):
return self._bool_item
@bool_item.setter
def bool_item(
self,
bool_item):
def bool_item(self, bool_item): # noqa: E501
"""Sets the bool_item of this TypeHolderExample.
@ -189,10 +207,11 @@ class TypeHolderExample(object):
:type: bool
"""
if bool_item is None:
raise ValueError("Invalid value for `bool_item`, must not be `None`") # noqa: E501
raise ApiValueError("Invalid value for `bool_item`, must not be `None`") # noqa: E501
self._bool_item = (
bool_item)
bool_item
)
@property
def array_item(self):
@ -205,9 +224,7 @@ class TypeHolderExample(object):
return self._array_item
@array_item.setter
def array_item(
self,
array_item):
def array_item(self, array_item): # noqa: E501
"""Sets the array_item of this TypeHolderExample.
@ -215,10 +232,11 @@ class TypeHolderExample(object):
:type: list[int]
"""
if array_item is None:
raise ValueError("Invalid value for `array_item`, must not be `None`") # noqa: E501
raise ApiValueError("Invalid value for `array_item`, must not be `None`") # noqa: E501
self._array_item = (
array_item)
array_item
)
def to_dict(self):
"""Returns the model properties as a dict"""

View File

@ -10,35 +10,45 @@
"""
import pprint
import pprint # noqa: F401
import re # noqa: F401
import six
import six # noqa: F401
from petstore_api.exceptions import ApiValueError # noqa: F401
from petstore_api.model_utils import ( # noqa: F401
ModelNormal,
ModelSimple,
check_allowed_values,
check_validations
)
class User(object):
class User(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
discriminator_value_class_map (dict): A dict to go from the discriminator
variable value to the discriminator class name.
openapi_types (dict): The key is attribute name
and the value is attribute type.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
"""
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
openapi_types = {
'id': 'int',
'username': 'str',
'first_name': 'str',
'last_name': 'str',
'email': 'str',
'password': 'str',
'phone': 'str',
'user_status': 'int',
allowed_values = {
}
attribute_map = {
@ -49,24 +59,25 @@ class User(object):
'email': 'email', # noqa: E501
'password': 'password', # noqa: E501
'phone': 'phone', # noqa: E501
'user_status': 'userStatus', # noqa: E501
'user_status': 'userStatus' # noqa: E501
}
openapi_types = {
'id': 'int',
'username': 'str',
'first_name': 'str',
'last_name': 'str',
'email': 'str',
'password': 'str',
'phone': 'str',
'user_status': 'int'
}
validations = {
}
def __init__(self, id=None, username=None, first_name=None, last_name=None, email=None, password=None, phone=None, user_status=None): # noqa: E501
"""User - a model defined in OpenAPI
Keyword Args:
id (int): [optional] # noqa: E501
username (str): [optional] # noqa: E501
first_name (str): [optional] # noqa: E501
last_name (str): [optional] # noqa: E501
email (str): [optional] # noqa: E501
password (str): [optional] # noqa: E501
phone (str): [optional] # noqa: E501
user_status (int): User Status. [optional] # noqa: E501
"""
"""User - a model defined in OpenAPI""" # noqa: E501
self._id = None
self._username = None
@ -79,21 +90,37 @@ class User(object):
self.discriminator = None
if id is not None:
self.id = id # noqa: E501
self.id = (
id
)
if username is not None:
self.username = username # noqa: E501
self.username = (
username
)
if first_name is not None:
self.first_name = first_name # noqa: E501
self.first_name = (
first_name
)
if last_name is not None:
self.last_name = last_name # noqa: E501
self.last_name = (
last_name
)
if email is not None:
self.email = email # noqa: E501
self.email = (
email
)
if password is not None:
self.password = password # noqa: E501
self.password = (
password
)
if phone is not None:
self.phone = phone # noqa: E501
self.phone = (
phone
)
if user_status is not None:
self.user_status = user_status # noqa: E501
self.user_status = (
user_status
)
@property
def id(self):
@ -106,9 +133,7 @@ class User(object):
return self._id
@id.setter
def id(
self,
id):
def id(self, id): # noqa: E501
"""Sets the id of this User.
@ -117,7 +142,8 @@ class User(object):
"""
self._id = (
id)
id
)
@property
def username(self):
@ -130,9 +156,7 @@ class User(object):
return self._username
@username.setter
def username(
self,
username):
def username(self, username): # noqa: E501
"""Sets the username of this User.
@ -141,7 +165,8 @@ class User(object):
"""
self._username = (
username)
username
)
@property
def first_name(self):
@ -154,9 +179,7 @@ class User(object):
return self._first_name
@first_name.setter
def first_name(
self,
first_name):
def first_name(self, first_name): # noqa: E501
"""Sets the first_name of this User.
@ -165,7 +188,8 @@ class User(object):
"""
self._first_name = (
first_name)
first_name
)
@property
def last_name(self):
@ -178,9 +202,7 @@ class User(object):
return self._last_name
@last_name.setter
def last_name(
self,
last_name):
def last_name(self, last_name): # noqa: E501
"""Sets the last_name of this User.
@ -189,7 +211,8 @@ class User(object):
"""
self._last_name = (
last_name)
last_name
)
@property
def email(self):
@ -202,9 +225,7 @@ class User(object):
return self._email
@email.setter
def email(
self,
email):
def email(self, email): # noqa: E501
"""Sets the email of this User.
@ -213,7 +234,8 @@ class User(object):
"""
self._email = (
email)
email
)
@property
def password(self):
@ -226,9 +248,7 @@ class User(object):
return self._password
@password.setter
def password(
self,
password):
def password(self, password): # noqa: E501
"""Sets the password of this User.
@ -237,7 +257,8 @@ class User(object):
"""
self._password = (
password)
password
)
@property
def phone(self):
@ -250,9 +271,7 @@ class User(object):
return self._phone
@phone.setter
def phone(
self,
phone):
def phone(self, phone): # noqa: E501
"""Sets the phone of this User.
@ -261,7 +280,8 @@ class User(object):
"""
self._phone = (
phone)
phone
)
@property
def user_status(self):
@ -275,9 +295,7 @@ class User(object):
return self._user_status
@user_status.setter
def user_status(
self,
user_status):
def user_status(self, user_status): # noqa: E501
"""Sets the user_status of this User.
User Status # noqa: E501
@ -287,7 +305,8 @@ class User(object):
"""
self._user_status = (
user_status)
user_status
)
def to_dict(self):
"""Returns the model properties as a dict"""

View File

@ -10,56 +10,45 @@
"""
import pprint
import pprint # noqa: F401
import re # noqa: F401
import six
import six # noqa: F401
from petstore_api.exceptions import ApiValueError # noqa: F401
from petstore_api.model_utils import ( # noqa: F401
ModelNormal,
ModelSimple,
check_allowed_values,
check_validations
)
class XmlItem(object):
class XmlItem(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
discriminator_value_class_map (dict): A dict to go from the discriminator
variable value to the discriminator class name.
openapi_types (dict): The key is attribute name
and the value is attribute type.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
"""
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
openapi_types = {
'attribute_string': 'str',
'attribute_number': 'float',
'attribute_integer': 'int',
'attribute_boolean': 'bool',
'wrapped_array': 'list[int]',
'name_string': 'str',
'name_number': 'float',
'name_integer': 'int',
'name_boolean': 'bool',
'name_array': 'list[int]',
'name_wrapped_array': 'list[int]',
'prefix_string': 'str',
'prefix_number': 'float',
'prefix_integer': 'int',
'prefix_boolean': 'bool',
'prefix_array': 'list[int]',
'prefix_wrapped_array': 'list[int]',
'namespace_string': 'str',
'namespace_number': 'float',
'namespace_integer': 'int',
'namespace_boolean': 'bool',
'namespace_array': 'list[int]',
'namespace_wrapped_array': 'list[int]',
'prefix_ns_string': 'str',
'prefix_ns_number': 'float',
'prefix_ns_integer': 'int',
'prefix_ns_boolean': 'bool',
'prefix_ns_array': 'list[int]',
'prefix_ns_wrapped_array': 'list[int]',
allowed_values = {
}
attribute_map = {
@ -91,45 +80,46 @@ class XmlItem(object):
'prefix_ns_integer': 'prefix_ns_integer', # noqa: E501
'prefix_ns_boolean': 'prefix_ns_boolean', # noqa: E501
'prefix_ns_array': 'prefix_ns_array', # noqa: E501
'prefix_ns_wrapped_array': 'prefix_ns_wrapped_array', # noqa: E501
'prefix_ns_wrapped_array': 'prefix_ns_wrapped_array' # noqa: E501
}
openapi_types = {
'attribute_string': 'str',
'attribute_number': 'float',
'attribute_integer': 'int',
'attribute_boolean': 'bool',
'wrapped_array': 'list[int]',
'name_string': 'str',
'name_number': 'float',
'name_integer': 'int',
'name_boolean': 'bool',
'name_array': 'list[int]',
'name_wrapped_array': 'list[int]',
'prefix_string': 'str',
'prefix_number': 'float',
'prefix_integer': 'int',
'prefix_boolean': 'bool',
'prefix_array': 'list[int]',
'prefix_wrapped_array': 'list[int]',
'namespace_string': 'str',
'namespace_number': 'float',
'namespace_integer': 'int',
'namespace_boolean': 'bool',
'namespace_array': 'list[int]',
'namespace_wrapped_array': 'list[int]',
'prefix_ns_string': 'str',
'prefix_ns_number': 'float',
'prefix_ns_integer': 'int',
'prefix_ns_boolean': 'bool',
'prefix_ns_array': 'list[int]',
'prefix_ns_wrapped_array': 'list[int]'
}
validations = {
}
def __init__(self, attribute_string=None, attribute_number=None, attribute_integer=None, attribute_boolean=None, wrapped_array=None, name_string=None, name_number=None, name_integer=None, name_boolean=None, name_array=None, name_wrapped_array=None, prefix_string=None, prefix_number=None, prefix_integer=None, prefix_boolean=None, prefix_array=None, prefix_wrapped_array=None, namespace_string=None, namespace_number=None, namespace_integer=None, namespace_boolean=None, namespace_array=None, namespace_wrapped_array=None, prefix_ns_string=None, prefix_ns_number=None, prefix_ns_integer=None, prefix_ns_boolean=None, prefix_ns_array=None, prefix_ns_wrapped_array=None): # noqa: E501
"""XmlItem - a model defined in OpenAPI
Keyword Args:
attribute_string (str): [optional] # noqa: E501
attribute_number (float): [optional] # noqa: E501
attribute_integer (int): [optional] # noqa: E501
attribute_boolean (bool): [optional] # noqa: E501
wrapped_array (list[int]): [optional] # noqa: E501
name_string (str): [optional] # noqa: E501
name_number (float): [optional] # noqa: E501
name_integer (int): [optional] # noqa: E501
name_boolean (bool): [optional] # noqa: E501
name_array (list[int]): [optional] # noqa: E501
name_wrapped_array (list[int]): [optional] # noqa: E501
prefix_string (str): [optional] # noqa: E501
prefix_number (float): [optional] # noqa: E501
prefix_integer (int): [optional] # noqa: E501
prefix_boolean (bool): [optional] # noqa: E501
prefix_array (list[int]): [optional] # noqa: E501
prefix_wrapped_array (list[int]): [optional] # noqa: E501
namespace_string (str): [optional] # noqa: E501
namespace_number (float): [optional] # noqa: E501
namespace_integer (int): [optional] # noqa: E501
namespace_boolean (bool): [optional] # noqa: E501
namespace_array (list[int]): [optional] # noqa: E501
namespace_wrapped_array (list[int]): [optional] # noqa: E501
prefix_ns_string (str): [optional] # noqa: E501
prefix_ns_number (float): [optional] # noqa: E501
prefix_ns_integer (int): [optional] # noqa: E501
prefix_ns_boolean (bool): [optional] # noqa: E501
prefix_ns_array (list[int]): [optional] # noqa: E501
prefix_ns_wrapped_array (list[int]): [optional] # noqa: E501
"""
"""XmlItem - a model defined in OpenAPI""" # noqa: E501
self._attribute_string = None
self._attribute_number = None
@ -163,63 +153,121 @@ class XmlItem(object):
self.discriminator = None
if attribute_string is not None:
self.attribute_string = attribute_string # noqa: E501
self.attribute_string = (
attribute_string
)
if attribute_number is not None:
self.attribute_number = attribute_number # noqa: E501
self.attribute_number = (
attribute_number
)
if attribute_integer is not None:
self.attribute_integer = attribute_integer # noqa: E501
self.attribute_integer = (
attribute_integer
)
if attribute_boolean is not None:
self.attribute_boolean = attribute_boolean # noqa: E501
self.attribute_boolean = (
attribute_boolean
)
if wrapped_array is not None:
self.wrapped_array = wrapped_array # noqa: E501
self.wrapped_array = (
wrapped_array
)
if name_string is not None:
self.name_string = name_string # noqa: E501
self.name_string = (
name_string
)
if name_number is not None:
self.name_number = name_number # noqa: E501
self.name_number = (
name_number
)
if name_integer is not None:
self.name_integer = name_integer # noqa: E501
self.name_integer = (
name_integer
)
if name_boolean is not None:
self.name_boolean = name_boolean # noqa: E501
self.name_boolean = (
name_boolean
)
if name_array is not None:
self.name_array = name_array # noqa: E501
self.name_array = (
name_array
)
if name_wrapped_array is not None:
self.name_wrapped_array = name_wrapped_array # noqa: E501
self.name_wrapped_array = (
name_wrapped_array
)
if prefix_string is not None:
self.prefix_string = prefix_string # noqa: E501
self.prefix_string = (
prefix_string
)
if prefix_number is not None:
self.prefix_number = prefix_number # noqa: E501
self.prefix_number = (
prefix_number
)
if prefix_integer is not None:
self.prefix_integer = prefix_integer # noqa: E501
self.prefix_integer = (
prefix_integer
)
if prefix_boolean is not None:
self.prefix_boolean = prefix_boolean # noqa: E501
self.prefix_boolean = (
prefix_boolean
)
if prefix_array is not None:
self.prefix_array = prefix_array # noqa: E501
self.prefix_array = (
prefix_array
)
if prefix_wrapped_array is not None:
self.prefix_wrapped_array = prefix_wrapped_array # noqa: E501
self.prefix_wrapped_array = (
prefix_wrapped_array
)
if namespace_string is not None:
self.namespace_string = namespace_string # noqa: E501
self.namespace_string = (
namespace_string
)
if namespace_number is not None:
self.namespace_number = namespace_number # noqa: E501
self.namespace_number = (
namespace_number
)
if namespace_integer is not None:
self.namespace_integer = namespace_integer # noqa: E501
self.namespace_integer = (
namespace_integer
)
if namespace_boolean is not None:
self.namespace_boolean = namespace_boolean # noqa: E501
self.namespace_boolean = (
namespace_boolean
)
if namespace_array is not None:
self.namespace_array = namespace_array # noqa: E501
self.namespace_array = (
namespace_array
)
if namespace_wrapped_array is not None:
self.namespace_wrapped_array = namespace_wrapped_array # noqa: E501
self.namespace_wrapped_array = (
namespace_wrapped_array
)
if prefix_ns_string is not None:
self.prefix_ns_string = prefix_ns_string # noqa: E501
self.prefix_ns_string = (
prefix_ns_string
)
if prefix_ns_number is not None:
self.prefix_ns_number = prefix_ns_number # noqa: E501
self.prefix_ns_number = (
prefix_ns_number
)
if prefix_ns_integer is not None:
self.prefix_ns_integer = prefix_ns_integer # noqa: E501
self.prefix_ns_integer = (
prefix_ns_integer
)
if prefix_ns_boolean is not None:
self.prefix_ns_boolean = prefix_ns_boolean # noqa: E501
self.prefix_ns_boolean = (
prefix_ns_boolean
)
if prefix_ns_array is not None:
self.prefix_ns_array = prefix_ns_array # noqa: E501
self.prefix_ns_array = (
prefix_ns_array
)
if prefix_ns_wrapped_array is not None:
self.prefix_ns_wrapped_array = prefix_ns_wrapped_array # noqa: E501
self.prefix_ns_wrapped_array = (
prefix_ns_wrapped_array
)
@property
def attribute_string(self):
@ -232,9 +280,7 @@ class XmlItem(object):
return self._attribute_string
@attribute_string.setter
def attribute_string(
self,
attribute_string):
def attribute_string(self, attribute_string): # noqa: E501
"""Sets the attribute_string of this XmlItem.
@ -243,7 +289,8 @@ class XmlItem(object):
"""
self._attribute_string = (
attribute_string)
attribute_string
)
@property
def attribute_number(self):
@ -256,9 +303,7 @@ class XmlItem(object):
return self._attribute_number
@attribute_number.setter
def attribute_number(
self,
attribute_number):
def attribute_number(self, attribute_number): # noqa: E501
"""Sets the attribute_number of this XmlItem.
@ -267,7 +312,8 @@ class XmlItem(object):
"""
self._attribute_number = (
attribute_number)
attribute_number
)
@property
def attribute_integer(self):
@ -280,9 +326,7 @@ class XmlItem(object):
return self._attribute_integer
@attribute_integer.setter
def attribute_integer(
self,
attribute_integer):
def attribute_integer(self, attribute_integer): # noqa: E501
"""Sets the attribute_integer of this XmlItem.
@ -291,7 +335,8 @@ class XmlItem(object):
"""
self._attribute_integer = (
attribute_integer)
attribute_integer
)
@property
def attribute_boolean(self):
@ -304,9 +349,7 @@ class XmlItem(object):
return self._attribute_boolean
@attribute_boolean.setter
def attribute_boolean(
self,
attribute_boolean):
def attribute_boolean(self, attribute_boolean): # noqa: E501
"""Sets the attribute_boolean of this XmlItem.
@ -315,7 +358,8 @@ class XmlItem(object):
"""
self._attribute_boolean = (
attribute_boolean)
attribute_boolean
)
@property
def wrapped_array(self):
@ -328,9 +372,7 @@ class XmlItem(object):
return self._wrapped_array
@wrapped_array.setter
def wrapped_array(
self,
wrapped_array):
def wrapped_array(self, wrapped_array): # noqa: E501
"""Sets the wrapped_array of this XmlItem.
@ -339,7 +381,8 @@ class XmlItem(object):
"""
self._wrapped_array = (
wrapped_array)
wrapped_array
)
@property
def name_string(self):
@ -352,9 +395,7 @@ class XmlItem(object):
return self._name_string
@name_string.setter
def name_string(
self,
name_string):
def name_string(self, name_string): # noqa: E501
"""Sets the name_string of this XmlItem.
@ -363,7 +404,8 @@ class XmlItem(object):
"""
self._name_string = (
name_string)
name_string
)
@property
def name_number(self):
@ -376,9 +418,7 @@ class XmlItem(object):
return self._name_number
@name_number.setter
def name_number(
self,
name_number):
def name_number(self, name_number): # noqa: E501
"""Sets the name_number of this XmlItem.
@ -387,7 +427,8 @@ class XmlItem(object):
"""
self._name_number = (
name_number)
name_number
)
@property
def name_integer(self):
@ -400,9 +441,7 @@ class XmlItem(object):
return self._name_integer
@name_integer.setter
def name_integer(
self,
name_integer):
def name_integer(self, name_integer): # noqa: E501
"""Sets the name_integer of this XmlItem.
@ -411,7 +450,8 @@ class XmlItem(object):
"""
self._name_integer = (
name_integer)
name_integer
)
@property
def name_boolean(self):
@ -424,9 +464,7 @@ class XmlItem(object):
return self._name_boolean
@name_boolean.setter
def name_boolean(
self,
name_boolean):
def name_boolean(self, name_boolean): # noqa: E501
"""Sets the name_boolean of this XmlItem.
@ -435,7 +473,8 @@ class XmlItem(object):
"""
self._name_boolean = (
name_boolean)
name_boolean
)
@property
def name_array(self):
@ -448,9 +487,7 @@ class XmlItem(object):
return self._name_array
@name_array.setter
def name_array(
self,
name_array):
def name_array(self, name_array): # noqa: E501
"""Sets the name_array of this XmlItem.
@ -459,7 +496,8 @@ class XmlItem(object):
"""
self._name_array = (
name_array)
name_array
)
@property
def name_wrapped_array(self):
@ -472,9 +510,7 @@ class XmlItem(object):
return self._name_wrapped_array
@name_wrapped_array.setter
def name_wrapped_array(
self,
name_wrapped_array):
def name_wrapped_array(self, name_wrapped_array): # noqa: E501
"""Sets the name_wrapped_array of this XmlItem.
@ -483,7 +519,8 @@ class XmlItem(object):
"""
self._name_wrapped_array = (
name_wrapped_array)
name_wrapped_array
)
@property
def prefix_string(self):
@ -496,9 +533,7 @@ class XmlItem(object):
return self._prefix_string
@prefix_string.setter
def prefix_string(
self,
prefix_string):
def prefix_string(self, prefix_string): # noqa: E501
"""Sets the prefix_string of this XmlItem.
@ -507,7 +542,8 @@ class XmlItem(object):
"""
self._prefix_string = (
prefix_string)
prefix_string
)
@property
def prefix_number(self):
@ -520,9 +556,7 @@ class XmlItem(object):
return self._prefix_number
@prefix_number.setter
def prefix_number(
self,
prefix_number):
def prefix_number(self, prefix_number): # noqa: E501
"""Sets the prefix_number of this XmlItem.
@ -531,7 +565,8 @@ class XmlItem(object):
"""
self._prefix_number = (
prefix_number)
prefix_number
)
@property
def prefix_integer(self):
@ -544,9 +579,7 @@ class XmlItem(object):
return self._prefix_integer
@prefix_integer.setter
def prefix_integer(
self,
prefix_integer):
def prefix_integer(self, prefix_integer): # noqa: E501
"""Sets the prefix_integer of this XmlItem.
@ -555,7 +588,8 @@ class XmlItem(object):
"""
self._prefix_integer = (
prefix_integer)
prefix_integer
)
@property
def prefix_boolean(self):
@ -568,9 +602,7 @@ class XmlItem(object):
return self._prefix_boolean
@prefix_boolean.setter
def prefix_boolean(
self,
prefix_boolean):
def prefix_boolean(self, prefix_boolean): # noqa: E501
"""Sets the prefix_boolean of this XmlItem.
@ -579,7 +611,8 @@ class XmlItem(object):
"""
self._prefix_boolean = (
prefix_boolean)
prefix_boolean
)
@property
def prefix_array(self):
@ -592,9 +625,7 @@ class XmlItem(object):
return self._prefix_array
@prefix_array.setter
def prefix_array(
self,
prefix_array):
def prefix_array(self, prefix_array): # noqa: E501
"""Sets the prefix_array of this XmlItem.
@ -603,7 +634,8 @@ class XmlItem(object):
"""
self._prefix_array = (
prefix_array)
prefix_array
)
@property
def prefix_wrapped_array(self):
@ -616,9 +648,7 @@ class XmlItem(object):
return self._prefix_wrapped_array
@prefix_wrapped_array.setter
def prefix_wrapped_array(
self,
prefix_wrapped_array):
def prefix_wrapped_array(self, prefix_wrapped_array): # noqa: E501
"""Sets the prefix_wrapped_array of this XmlItem.
@ -627,7 +657,8 @@ class XmlItem(object):
"""
self._prefix_wrapped_array = (
prefix_wrapped_array)
prefix_wrapped_array
)
@property
def namespace_string(self):
@ -640,9 +671,7 @@ class XmlItem(object):
return self._namespace_string
@namespace_string.setter
def namespace_string(
self,
namespace_string):
def namespace_string(self, namespace_string): # noqa: E501
"""Sets the namespace_string of this XmlItem.
@ -651,7 +680,8 @@ class XmlItem(object):
"""
self._namespace_string = (
namespace_string)
namespace_string
)
@property
def namespace_number(self):
@ -664,9 +694,7 @@ class XmlItem(object):
return self._namespace_number
@namespace_number.setter
def namespace_number(
self,
namespace_number):
def namespace_number(self, namespace_number): # noqa: E501
"""Sets the namespace_number of this XmlItem.
@ -675,7 +703,8 @@ class XmlItem(object):
"""
self._namespace_number = (
namespace_number)
namespace_number
)
@property
def namespace_integer(self):
@ -688,9 +717,7 @@ class XmlItem(object):
return self._namespace_integer
@namespace_integer.setter
def namespace_integer(
self,
namespace_integer):
def namespace_integer(self, namespace_integer): # noqa: E501
"""Sets the namespace_integer of this XmlItem.
@ -699,7 +726,8 @@ class XmlItem(object):
"""
self._namespace_integer = (
namespace_integer)
namespace_integer
)
@property
def namespace_boolean(self):
@ -712,9 +740,7 @@ class XmlItem(object):
return self._namespace_boolean
@namespace_boolean.setter
def namespace_boolean(
self,
namespace_boolean):
def namespace_boolean(self, namespace_boolean): # noqa: E501
"""Sets the namespace_boolean of this XmlItem.
@ -723,7 +749,8 @@ class XmlItem(object):
"""
self._namespace_boolean = (
namespace_boolean)
namespace_boolean
)
@property
def namespace_array(self):
@ -736,9 +763,7 @@ class XmlItem(object):
return self._namespace_array
@namespace_array.setter
def namespace_array(
self,
namespace_array):
def namespace_array(self, namespace_array): # noqa: E501
"""Sets the namespace_array of this XmlItem.
@ -747,7 +772,8 @@ class XmlItem(object):
"""
self._namespace_array = (
namespace_array)
namespace_array
)
@property
def namespace_wrapped_array(self):
@ -760,9 +786,7 @@ class XmlItem(object):
return self._namespace_wrapped_array
@namespace_wrapped_array.setter
def namespace_wrapped_array(
self,
namespace_wrapped_array):
def namespace_wrapped_array(self, namespace_wrapped_array): # noqa: E501
"""Sets the namespace_wrapped_array of this XmlItem.
@ -771,7 +795,8 @@ class XmlItem(object):
"""
self._namespace_wrapped_array = (
namespace_wrapped_array)
namespace_wrapped_array
)
@property
def prefix_ns_string(self):
@ -784,9 +809,7 @@ class XmlItem(object):
return self._prefix_ns_string
@prefix_ns_string.setter
def prefix_ns_string(
self,
prefix_ns_string):
def prefix_ns_string(self, prefix_ns_string): # noqa: E501
"""Sets the prefix_ns_string of this XmlItem.
@ -795,7 +818,8 @@ class XmlItem(object):
"""
self._prefix_ns_string = (
prefix_ns_string)
prefix_ns_string
)
@property
def prefix_ns_number(self):
@ -808,9 +832,7 @@ class XmlItem(object):
return self._prefix_ns_number
@prefix_ns_number.setter
def prefix_ns_number(
self,
prefix_ns_number):
def prefix_ns_number(self, prefix_ns_number): # noqa: E501
"""Sets the prefix_ns_number of this XmlItem.
@ -819,7 +841,8 @@ class XmlItem(object):
"""
self._prefix_ns_number = (
prefix_ns_number)
prefix_ns_number
)
@property
def prefix_ns_integer(self):
@ -832,9 +855,7 @@ class XmlItem(object):
return self._prefix_ns_integer
@prefix_ns_integer.setter
def prefix_ns_integer(
self,
prefix_ns_integer):
def prefix_ns_integer(self, prefix_ns_integer): # noqa: E501
"""Sets the prefix_ns_integer of this XmlItem.
@ -843,7 +864,8 @@ class XmlItem(object):
"""
self._prefix_ns_integer = (
prefix_ns_integer)
prefix_ns_integer
)
@property
def prefix_ns_boolean(self):
@ -856,9 +878,7 @@ class XmlItem(object):
return self._prefix_ns_boolean
@prefix_ns_boolean.setter
def prefix_ns_boolean(
self,
prefix_ns_boolean):
def prefix_ns_boolean(self, prefix_ns_boolean): # noqa: E501
"""Sets the prefix_ns_boolean of this XmlItem.
@ -867,7 +887,8 @@ class XmlItem(object):
"""
self._prefix_ns_boolean = (
prefix_ns_boolean)
prefix_ns_boolean
)
@property
def prefix_ns_array(self):
@ -880,9 +901,7 @@ class XmlItem(object):
return self._prefix_ns_array
@prefix_ns_array.setter
def prefix_ns_array(
self,
prefix_ns_array):
def prefix_ns_array(self, prefix_ns_array): # noqa: E501
"""Sets the prefix_ns_array of this XmlItem.
@ -891,7 +910,8 @@ class XmlItem(object):
"""
self._prefix_ns_array = (
prefix_ns_array)
prefix_ns_array
)
@property
def prefix_ns_wrapped_array(self):
@ -904,9 +924,7 @@ class XmlItem(object):
return self._prefix_ns_wrapped_array
@prefix_ns_wrapped_array.setter
def prefix_ns_wrapped_array(
self,
prefix_ns_wrapped_array):
def prefix_ns_wrapped_array(self, prefix_ns_wrapped_array): # noqa: E501
"""Sets the prefix_ns_wrapped_array of this XmlItem.
@ -915,7 +933,8 @@ class XmlItem(object):
"""
self._prefix_ns_wrapped_array = (
prefix_ns_wrapped_array)
prefix_ns_wrapped_array
)
def to_dict(self):
"""Returns the model properties as a dict"""

View File

@ -31,7 +31,7 @@ setup(
url="",
keywords=["OpenAPI", "OpenAPI-Generator", "OpenAPI Petstore"],
install_requires=REQUIRES,
packages=find_packages(),
packages=find_packages(exclude=["test", "tests"]),
include_package_data=True,
long_description="""\
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \&quot; \\ # noqa: E501

View File

@ -40,11 +40,23 @@ class TestFakeApi(unittest.TestCase):
"""
pass
def test_fake_outer_enum_serialize(self):
"""Test case for fake_outer_enum_serialize
"""
# verify that the input and output are type OuterEnum
endpoint = self.api.fake_outer_enum_serialize
assert endpoint.openapi_types['body'] == 'OuterEnum'
assert endpoint.settings['response_type'] == 'OuterEnum'
def test_fake_outer_number_serialize(self):
"""Test case for fake_outer_number_serialize
"""
pass
# verify that the input and output are the correct type
endpoint = self.api.fake_outer_number_serialize
assert endpoint.openapi_types['body'] == 'OuterNumber'
assert endpoint.settings['response_type'] == 'OuterNumber'
def test_fake_outer_string_serialize(self):
"""Test case for fake_outer_string_serialize
@ -70,14 +82,38 @@ class TestFakeApi(unittest.TestCase):
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501
"""
pass
# check that we can access the endpoint's validations
endpoint = self.api.test_endpoint_parameters
assert endpoint.validations[('number',)] == {
'inclusive_maximum': 543.2,
'inclusive_minimum': 32.1,
}
# make sure that an exception is thrown on an invalid value
keyword_args = dict(
number=544, # invalid
double=100,
pattern_without_delimiter="abc",
byte='sample string'
)
with self.assertRaises(petstore_api.ApiValueError):
self.api.test_endpoint_parameters(**keyword_args)
def test_test_enum_parameters(self):
"""Test case for test_enum_parameters
To test enum parameters # noqa: E501
"""
pass
# check that we can access the endpoint's allowed_values
endpoint = self.api.test_enum_parameters
assert endpoint.allowed_values[('enum_query_string',)] == {
"_ABC": "_abc",
"-EFG": "-efg",
"(XYZ)": "(xyz)"
}
# make sure that an exception is thrown on an invalid value
keyword_args = dict(enum_query_string="bad value")
with self.assertRaises(petstore_api.ApiValueError):
self.api.test_enum_parameters(**keyword_args)
def test_test_inline_additional_properties(self):
"""Test case for test_inline_additional_properties

View File

@ -2,9 +2,7 @@
"""
OpenAPI Petstore
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501
OpenAPI spec version: 1.0.0
Generated by: https://openapi-generator.tech
"""
@ -16,24 +14,139 @@ import unittest
import petstore_api
from petstore_api.models.format_test import FormatTest # noqa: E501
from petstore_api.rest import ApiException
from petstore_api import ApiValueError
class TestFormatTest(unittest.TestCase):
"""FormatTest unit test stubs"""
def setUp(self):
pass
self.required_named_args = dict(
number=40.1,
byte='what',
date='2019-03-23',
password='rainbowtable'
)
def tearDown(self):
pass
def test_integer(self):
var_name = 'integer'
validations = FormatTest.validations[(var_name,)]
keyword_args = {}
keyword_args.update(self.required_named_args)
key_adder_pairs = [('inclusive_maximum', 1), ('inclusive_minimum', -1)]
for key, adder in key_adder_pairs:
# value outside the bounds throws an error
with self.assertRaises(ApiValueError):
keyword_args[var_name] = validations[key] + adder
FormatTest(**keyword_args)
def testFormatTest(self):
"""Test FormatTest"""
# FIXME: construct object with mandatory attributes with example values
# model = petstore_api.models.format_test.FormatTest() # noqa: E501
pass
# value inside the bounds works
keyword_args[var_name] = validations[key]
assert (getattr(FormatTest(**keyword_args), var_name) ==
validations[key])
def test_int32(self):
var_name = 'int32'
validations = FormatTest.validations[(var_name,)]
keyword_args = {}
keyword_args.update(self.required_named_args)
key_adder_pairs = [('inclusive_maximum', 1), ('inclusive_minimum', -1)]
for key, adder in key_adder_pairs:
# value outside the bounds throws an error
with self.assertRaises(ApiValueError):
keyword_args[var_name] = validations[key] + adder
FormatTest(**keyword_args)
# value inside the bounds works
keyword_args[var_name] = validations[key]
assert (getattr(FormatTest(**keyword_args), var_name) ==
validations[key])
def test_number(self):
var_name = 'number'
validations = FormatTest.validations[(var_name,)]
keyword_args = {}
keyword_args.update(self.required_named_args)
key_adder_pairs = [('inclusive_maximum', 1), ('inclusive_minimum', -1)]
for key, adder in key_adder_pairs:
# value outside the bounds throws an error
with self.assertRaises(ApiValueError):
keyword_args[var_name] = validations[key] + adder
FormatTest(**keyword_args)
# value inside the bounds works
keyword_args[var_name] = validations[key]
assert (getattr(FormatTest(**keyword_args), var_name) ==
validations[key])
def test_float(self):
var_name = 'float'
validations = FormatTest.validations[(var_name,)]
keyword_args = {}
keyword_args.update(self.required_named_args)
key_adder_pairs = [('inclusive_maximum', 1), ('inclusive_minimum', -1)]
for key, adder in key_adder_pairs:
# value outside the bounds throws an error
with self.assertRaises(ApiValueError):
keyword_args[var_name] = validations[key] + adder
FormatTest(**keyword_args)
# value inside the bounds works
keyword_args[var_name] = validations[key]
assert (getattr(FormatTest(**keyword_args), var_name) ==
validations[key])
def test_double(self):
var_name = 'double'
validations = FormatTest.validations[(var_name,)]
keyword_args = {}
keyword_args.update(self.required_named_args)
key_adder_pairs = [('inclusive_maximum', 1), ('inclusive_minimum', -1)]
for key, adder in key_adder_pairs:
# value outside the bounds throws an error
with self.assertRaises(ApiValueError):
keyword_args[var_name] = validations[key] + adder
FormatTest(**keyword_args)
# value inside the bounds works
keyword_args[var_name] = validations[key]
assert (getattr(FormatTest(**keyword_args), var_name) ==
validations[key])
def test_password(self):
var_name = 'password'
validations = FormatTest.validations[(var_name,)]
keyword_args = {}
keyword_args.update(self.required_named_args)
key_adder_pairs = [('max_length', 1), ('min_length', -1)]
for key, adder in key_adder_pairs:
# value outside the bounds throws an error
with self.assertRaises(ApiValueError):
keyword_args[var_name] = 'a'*(validations[key] + adder)
FormatTest(**keyword_args)
# value inside the bounds works
keyword_args[var_name] = 'a'*validations[key]
assert (getattr(FormatTest(**keyword_args), var_name) ==
'a'*validations[key])
def test_string(self):
var_name = 'string'
validations = FormatTest.validations[(var_name,)]
keyword_args = {}
keyword_args.update(self.required_named_args)
values_invalid = ['abc3', '1', '.', ' ', 'مرحبا', '']
for value_invalid in values_invalid:
# invalid values throw exceptions
with self.assertRaises(ApiValueError):
keyword_args[var_name] = value_invalid
FormatTest(**keyword_args)
# valid value works
value_valid = 'abcdz'
keyword_args[var_name] = value_valid
assert getattr(FormatTest(**keyword_args), var_name) == value_valid
if __name__ == '__main__':
unittest.main()
unittest.main()

View File

@ -5,7 +5,7 @@
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501
OpenAPI spec version: 1.0.0
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
"""
@ -30,10 +30,18 @@ class TestOuterEnum(unittest.TestCase):
def testOuterEnum(self):
"""Test OuterEnum"""
# FIXME: construct object with mandatory attributes with example values
# model = petstore_api.models.outer_enum.OuterEnum() # noqa: E501
pass
# make sure that we can access its allowed_values
assert OuterEnum.allowed_values[('value',)] == {
'PLACED': "placed",
'APPROVED': "approved",
'DELIVERED': "delivered"
}
# make sure that an exception is thrown on an invalid value
with self.assertRaises(petstore_api.ApiValueError):
OuterEnum('bad_value')
# make sure valid value works
valid_value = OuterEnum.allowed_values[('value',)]['PLACED']
assert valid_value == OuterEnum(valid_value).value
if __name__ == '__main__':
unittest.main()

Some files were not shown because too many files have changed in this diff Show More