From 83da8e1b8dedd5c3ac1087f02c72a72253051283 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Mon, 25 Sep 2023 12:47:10 +0800 Subject: [PATCH 1/7] rename, add tests --- .../AbstractPythonPydanticV1Codegen.java | 1997 +++++++++++++++++ ...ava => PythonPydanticV1ClientCodegen.java} | 6 +- .../org.openapitools.codegen.CodegenConfig | 2 +- .../PythonPydanticV1ClientCodegenTest.java | 504 +++++ 4 files changed, 2505 insertions(+), 4 deletions(-) create mode 100644 modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonPydanticV1Codegen.java rename modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/{PythonClientPydanticV1Codegen.java => PythonPydanticV1ClientCodegen.java} (99%) create mode 100644 modules/openapi-generator/src/test/java/org/openapitools/codegen/python/PythonPydanticV1ClientCodegenTest.java diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonPydanticV1Codegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonPydanticV1Codegen.java new file mode 100644 index 000000000000..5fc6023360f9 --- /dev/null +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonPydanticV1Codegen.java @@ -0,0 +1,1997 @@ +/* + * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openapitools.codegen.languages; + +import com.github.curiousoddman.rgxgen.RgxGen; +import io.swagger.v3.oas.models.examples.Example; +import io.swagger.v3.oas.models.media.ArraySchema; +import io.swagger.v3.oas.models.media.Schema; +import io.swagger.v3.oas.models.parameters.Parameter; +import org.apache.commons.io.FilenameUtils; +import org.apache.commons.lang3.StringUtils; +import org.openapitools.codegen.*; +import org.openapitools.codegen.meta.features.SecurityFeature; +import org.openapitools.codegen.model.ModelMap; +import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; +import org.openapitools.codegen.utils.ModelUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.File; +import java.io.IOException; +import java.util.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; + +import static org.openapitools.codegen.utils.StringUtils.*; + +public abstract class AbstractPythonPydanticV1Codegen extends DefaultCodegen implements CodegenConfig { + private final Logger LOGGER = LoggerFactory.getLogger(AbstractPythonPydanticV1Codegen.class); + + public static final String MAP_NUMBER_TO = "mapNumberTo"; + + protected String packageName = "openapi_client"; + protected String packageVersion = "1.0.0"; + protected String projectName; // for setup.py, e.g. petstore-api + protected boolean hasModelsToImport = Boolean.FALSE; + protected String mapNumberTo = "Union[StrictFloat, StrictInt]"; + protected Map regexModifiers; + + private Map schemaKeyToModelNameCache = new HashMap<>(); + // map of set (model imports) + private HashMap> circularImports = new HashMap<>(); + // map of codegen models + private HashMap codegenModelMap = new HashMap<>(); + + public AbstractPythonPydanticV1Codegen() { + super(); + + modifyFeatureSet(features -> features.securityFeatures(EnumSet.of( + SecurityFeature.BasicAuth, + SecurityFeature.BearerToken, + SecurityFeature.ApiKey, + SecurityFeature.OAuth2_Implicit + ))); + + // from https://docs.python.org/3/reference/lexical_analysis.html#keywords + setReservedWordsLowerCase( + Arrays.asList( + // local variable name used in API methods (endpoints) + "all_params", "resource_path", "path_params", "query_params", + "header_params", "form_params", "local_var_files", "body_params", "auth_settings", + // @property + "property", + // python reserved words + "and", "del", "from", "not", "while", "as", "elif", "global", "or", "with", + "assert", "else", "if", "pass", "yield", "break", "except", "import", + "print", "class", "exec", "in", "raise", "continue", "finally", "is", + "return", "def", "for", "lambda", "try", "self", "nonlocal", "None", "True", + "False", "async", "await")); + + languageSpecificPrimitives.clear(); + languageSpecificPrimitives.add("int"); + languageSpecificPrimitives.add("float"); + languageSpecificPrimitives.add("list"); + languageSpecificPrimitives.add("dict"); + languageSpecificPrimitives.add("List"); + languageSpecificPrimitives.add("Dict"); + languageSpecificPrimitives.add("bool"); + languageSpecificPrimitives.add("str"); + languageSpecificPrimitives.add("datetime"); + languageSpecificPrimitives.add("date"); + languageSpecificPrimitives.add("object"); + // TODO file and binary is mapped as `file` + languageSpecificPrimitives.add("file"); + languageSpecificPrimitives.add("bytes"); + + typeMapping.clear(); + typeMapping.put("integer", "int"); + typeMapping.put("float", "float"); + typeMapping.put("number", "float"); + typeMapping.put("long", "int"); + typeMapping.put("double", "float"); + typeMapping.put("array", "list"); + typeMapping.put("set", "list"); + typeMapping.put("map", "dict"); + typeMapping.put("boolean", "bool"); + typeMapping.put("string", "str"); + typeMapping.put("date", "date"); + typeMapping.put("DateTime", "datetime"); + typeMapping.put("object", "object"); + typeMapping.put("AnyType", "object"); + typeMapping.put("file", "file"); + // TODO binary should be mapped to byte array + // mapped to String as a workaround + typeMapping.put("binary", "str"); + typeMapping.put("ByteArray", "str"); + // map uuid to string for the time being + typeMapping.put("UUID", "str"); + typeMapping.put("URI", "str"); + typeMapping.put("null", "none_type"); + + regexModifiers = new HashMap(); + regexModifiers.put('i', "IGNORECASE"); + regexModifiers.put('l', "LOCALE"); + regexModifiers.put('m', "MULTILINE"); + regexModifiers.put('s', "DOTALL"); + regexModifiers.put('u', "UNICODE"); + regexModifiers.put('x', "VERBOSE"); + } + + @Override + public void processOpts() { + super.processOpts(); + + if (StringUtils.isEmpty(System.getenv("PYTHON_POST_PROCESS_FILE"))) { + LOGGER.info("Environment variable PYTHON_POST_PROCESS_FILE not defined so the Python code may not be properly formatted. To define it, try 'export PYTHON_POST_PROCESS_FILE=\"/usr/local/bin/yapf -i\"' (Linux/Mac)"); + LOGGER.info("NOTE: To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI)."); + } + } + + @Override + public String escapeReservedWord(String name) { + if (this.reservedWordsMappings().containsKey(name)) { + return this.reservedWordsMappings().get(name); + } + return "_" + name; + } + + + /** + * Return the default value of the property + * + * @param p OpenAPI property object + * @return string presentation of the default value of the property + */ + @Override + public String toDefaultValue(Schema p) { + if (ModelUtils.isBooleanSchema(p)) { + if (p.getDefault() != null) { + if (!Boolean.valueOf(p.getDefault().toString())) + return "False"; + else + return "True"; + } + } else if (ModelUtils.isDateSchema(p)) { + // TODO + } else if (ModelUtils.isDateTimeSchema(p)) { + // TODO + } else if (ModelUtils.isNumberSchema(p)) { + if (p.getDefault() != null) { + return p.getDefault().toString(); + } + } else if (ModelUtils.isIntegerSchema(p)) { + if (p.getDefault() != null) { + return p.getDefault().toString(); + } + } else if (ModelUtils.isStringSchema(p)) { + if (p.getDefault() != null) { + String defaultValue = String.valueOf(p.getDefault()); + if (defaultValue != null) { + defaultValue = defaultValue.replace("\\", "\\\\") + .replace("'", "\'"); + if (Pattern.compile("\r\n|\r|\n").matcher(defaultValue).find()) { + return "'''" + defaultValue + "'''"; + } else { + return "'" + defaultValue + "'"; + } + } + } + } else if (ModelUtils.isArraySchema(p)) { + if (p.getDefault() != null) { + return p.getDefault().toString(); + } else { + return null; + } + } + + return null; + } + + + @Override + public String toVarName(String name) { + // obtain the name from nameMapping directly if provided + if (nameMapping.containsKey(name)) { + return nameMapping.get(name); + } + + // sanitize name + name = sanitizeName(name); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'. + + // remove dollar sign + name = name.replace("$", ""); + + // if it's all upper case, convert to lower case + if (name.matches("^[A-Z_]*$")) { + name = name.toLowerCase(Locale.ROOT); + } + + // underscore the variable name + // petId => pet_id + name = underscore(name); + + // remove leading underscore + name = name.replaceAll("^_*", ""); + + // for reserved word or word starting with number, append _ + if (isReservedWord(name) || name.matches("^\\d.*")) { + name = escapeReservedWord(name); + } + + return name; + } + + @Override + public String toRegularExpression(String pattern) { + return addRegularExpressionDelimiter(pattern); + } + + @Override + public String toParamName(String name) { + // obtain the name from parameterNameMapping directly if provided + if (parameterNameMapping.containsKey(name)) { + return parameterNameMapping.get(name); + } + + // to avoid conflicts with 'callback' parameter for async call + if ("callback".equals(name)) { + return "param_callback"; + } + + // should be the same as variable name + return toVarName(name); + } + + @Override + public String toOperationId(String operationId) { + // throw exception if method name is empty (should not occur as an auto-generated method name will be used) + if (StringUtils.isEmpty(operationId)) { + throw new RuntimeException("Empty method name (operationId) not allowed"); + } + + // method name cannot use reserved keyword, e.g. return + if (isReservedWord(operationId)) { + LOGGER.warn("{} (reserved word) cannot be used as method name. Renamed to {}", operationId, underscore(sanitizeName("call_" + operationId))); + operationId = "call_" + operationId; + } + + // operationId starts with a number + if (operationId.matches("^\\d.*")) { + LOGGER.warn("{} (starting with a number) cannot be used as method name. Renamed to {}", operationId, underscore(sanitizeName("call_" + operationId))); + operationId = "call_" + operationId; + } + + return underscore(sanitizeName(operationId)); + } + + @Override + public String escapeQuotationMark(String input) { + // remove ' to avoid code injection + return input.replace("'", ""); + } + + @Override + public String escapeUnsafeCharacters(String input) { + // remove multiline comment + return input.replace("'''", "'_'_'"); + } + + @Override + public void postProcessFile(File file, String fileType) { + if (file == null) { + return; + } + String pythonPostProcessFile = System.getenv("PYTHON_POST_PROCESS_FILE"); + if (StringUtils.isEmpty(pythonPostProcessFile)) { + return; // skip if PYTHON_POST_PROCESS_FILE env variable is not defined + } + + // only process files with py extension + if ("py".equals(FilenameUtils.getExtension(file.toString()))) { + String command = pythonPostProcessFile + " " + file; + try { + Process p = Runtime.getRuntime().exec(command); + int exitValue = p.waitFor(); + if (exitValue != 0) { + LOGGER.error("Error running the command ({}). Exit value: {}", command, exitValue); + } else { + LOGGER.info("Successfully executed: {}", command); + } + } catch (InterruptedException | IOException e) { + LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage()); + // Restore interrupted state + Thread.currentThread().interrupt(); + } + } + } + + @Override + public String toExampleValue(Schema schema) { + return toExampleValueRecursive(schema, new ArrayList<>(), 5); + } + + private String toExampleValueRecursive(Schema schema, List includedSchemas, int indentation) { + boolean cycleFound = includedSchemas.stream().filter(s -> schema.equals(s)).count() > 1; + if (cycleFound) { + return ""; + } + String indentationString = ""; + for (int i = 0; i < indentation; i++) indentationString += " "; + String example = null; + if (schema.getExample() != null) { + example = schema.getExample().toString(); + } + + if (ModelUtils.isNullType(schema) && null != example) { + // The 'null' type is allowed in OAS 3.1 and above. It is not supported by OAS 3.0.x, + // though this tooling supports it. + return "None"; + } + // correct "true"s into "True"s, since super.toExampleValue uses "toString()" on Java booleans + if (ModelUtils.isBooleanSchema(schema) && null != example) { + if ("false".equalsIgnoreCase(example)) example = "False"; + else example = "True"; + } + + // correct "'"s into "'"s after toString() + if (ModelUtils.isStringSchema(schema) && schema.getDefault() != null && !ModelUtils.isDateSchema(schema) && !ModelUtils.isDateTimeSchema(schema)) { + example = String.valueOf(schema.getDefault()); + } + + if (StringUtils.isNotBlank(example) && !"null".equals(example)) { + if (ModelUtils.isStringSchema(schema)) { + example = "'" + example + "'"; + } + return example; + } + + if (schema.getEnum() != null && !schema.getEnum().isEmpty()) { + // Enum case: + example = schema.getEnum().get(0).toString(); + if (ModelUtils.isStringSchema(schema)) { + example = "'" + escapeText(example) + "'"; + } + if (null == example) + LOGGER.warn("Empty enum. Cannot built an example!"); + + return example; + } else if (null != schema.get$ref()) { + // $ref case: + Map allDefinitions = ModelUtils.getSchemas(this.openAPI); + String ref = ModelUtils.getSimpleRef(schema.get$ref()); + if (allDefinitions != null) { + Schema refSchema = allDefinitions.get(ref); + if (null == refSchema) { + return "None"; + } else { + String refTitle = refSchema.getTitle(); + if (StringUtils.isBlank(refTitle) || "null".equals(refTitle)) { + refSchema.setTitle(ref); + } + if (StringUtils.isNotBlank(schema.getTitle()) && !"null".equals(schema.getTitle())) { + includedSchemas.add(schema); + } + return toExampleValueRecursive(refSchema, includedSchemas, indentation); + } + } else { + LOGGER.warn("allDefinitions not defined in toExampleValue!\n"); + } + } + if (ModelUtils.isDateSchema(schema)) { + example = "datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date()"; + return example; + } else if (ModelUtils.isDateTimeSchema(schema)) { + example = "datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f')"; + return example; + } else if (ModelUtils.isBinarySchema(schema)) { + example = "bytes(b'blah')"; + return example; + } else if (ModelUtils.isByteArraySchema(schema)) { + example = "YQ=="; + } else if (ModelUtils.isStringSchema(schema)) { + // a BigDecimal: + if ("Number".equalsIgnoreCase(schema.getFormat())) { + return "1"; + } + if (StringUtils.isNotBlank(schema.getPattern())) { + String pattern = schema.getPattern(); + RgxGen rgxGen = new RgxGen(patternCorrection(pattern)); + // this seed makes it so if we have [a-z] we pick a + Random random = new Random(18); + String sample = rgxGen.generate(random); + // omit leading / and trailing /, omit trailing /i + Pattern valueExtractor = Pattern.compile("^/\\^?(.+?)\\$?/.?$"); + Matcher m = valueExtractor.matcher(sample); + if (m.find()) { + example = m.group(m.groupCount()); + } else { + example = sample; + } + } + if (example == null) { + example = ""; + } + int len = 0; + if (null != schema.getMinLength()) { + len = schema.getMinLength().intValue(); + if (len < 1) { + example = ""; + } else { + for (int i = 0; i < len; i++) example += i; + } + } + } else if (ModelUtils.isIntegerSchema(schema)) { + if (schema.getMinimum() != null) + example = schema.getMinimum().toString(); + else + example = "56"; + } else if (ModelUtils.isNumberSchema(schema)) { + if (schema.getMinimum() != null) + example = schema.getMinimum().toString(); + else + example = "1.337"; + } else if (ModelUtils.isBooleanSchema(schema)) { + example = "True"; + } else if (ModelUtils.isArraySchema(schema)) { + if (StringUtils.isNotBlank(schema.getTitle()) && !"null".equals(schema.getTitle())) { + includedSchemas.add(schema); + } + ArraySchema arrayschema = (ArraySchema) schema; + example = "[\n" + indentationString + toExampleValueRecursive(arrayschema.getItems(), includedSchemas, indentation + 1) + "\n" + indentationString + "]"; + } else if (ModelUtils.isMapSchema(schema)) { + if (StringUtils.isNotBlank(schema.getTitle()) && !"null".equals(schema.getTitle())) { + includedSchemas.add(schema); + } + Object additionalObject = schema.getAdditionalProperties(); + if (additionalObject instanceof Schema) { + Schema additional = (Schema) additionalObject; + String theKey = "'key'"; + if (additional.getEnum() != null && !additional.getEnum().isEmpty()) { + theKey = additional.getEnum().get(0).toString(); + if (ModelUtils.isStringSchema(additional)) { + theKey = "'" + escapeText(theKey) + "'"; + } + } + example = "{\n" + indentationString + theKey + " : " + toExampleValueRecursive(additional, includedSchemas, indentation + 1) + "\n" + indentationString + "}"; + } else { + example = "{ }"; + } + } else if (ModelUtils.isObjectSchema(schema)) { + if (StringUtils.isBlank(schema.getTitle())) { + example = "None"; + return example; + } + + // I remove any property that is a discriminator, since it is not well supported by the python generator + String toExclude = null; + if (schema.getDiscriminator() != null) { + toExclude = schema.getDiscriminator().getPropertyName(); + } + + example = packageName + ".models." + underscore(schema.getTitle()) + "." + schema.getTitle() + "("; + + // if required only: + // List reqs = schema.getRequired(); + + // if required and optionals + List reqs = new ArrayList<>(); + if (schema.getProperties() != null && !schema.getProperties().isEmpty()) { + for (Object toAdd : schema.getProperties().keySet()) { + reqs.add((String) toAdd); + } + + Map properties = schema.getProperties(); + Set propkeys = null; + if (properties != null) propkeys = properties.keySet(); + if (toExclude != null && reqs.contains(toExclude)) { + reqs.remove(toExclude); + } + for (String toRemove : includedSchemas.stream().map(Schema::getTitle).collect(Collectors.toList())) { + if (reqs.contains(toRemove)) { + reqs.remove(toRemove); + } + } + if (StringUtils.isNotBlank(schema.getTitle()) && !"null".equals(schema.getTitle())) { + includedSchemas.add(schema); + } + if (null != schema.getRequired()) for (Object toAdd : schema.getRequired()) { + reqs.add((String) toAdd); + } + if (null != propkeys) for (String propname : propkeys) { + Schema schema2 = properties.get(propname); + if (reqs.contains(propname)) { + String refTitle = schema2.getTitle(); + if (StringUtils.isBlank(refTitle) || "null".equals(refTitle)) { + schema2.setTitle(propname); + } + example += "\n" + indentationString + underscore(propname) + " = " + + toExampleValueRecursive(schema2, includedSchemas, indentation + 1) + ", "; + } + } + } + example += ")"; + } else { + LOGGER.debug("Type {} not handled properly in toExampleValue", schema.getType()); + } + + if (ModelUtils.isStringSchema(schema)) { + example = "'" + escapeText(example) + "'"; + } + + return example; + } + + @Override + public void setParameterExampleValue(CodegenParameter p) { + String example; + + if (p.defaultValue == null) { + example = p.example; + } else { + p.example = p.defaultValue; + return; + } + + String type = p.baseType; + if (type == null) { + type = p.dataType; + } + + if ("String".equalsIgnoreCase(type) || "str".equalsIgnoreCase(type)) { + if (example == null) { + example = p.paramName + "_example"; + } + example = "'" + escapeText(example) + "'"; + } else if ("Integer".equals(type) || "int".equals(type)) { + if (example == null) { + example = "56"; + } + } else if ("Float".equalsIgnoreCase(type) || "Double".equalsIgnoreCase(type)) { + if (example == null) { + example = "3.4"; + } + } else if ("BOOLEAN".equalsIgnoreCase(type) || "bool".equalsIgnoreCase(type)) { + if (example == null) { + example = "True"; + } + } else if ("file".equalsIgnoreCase(type)) { + if (example == null) { + example = "/path/to/file"; + } + example = "'" + escapeText(example) + "'"; + } else if ("Date".equalsIgnoreCase(type)) { + if (example == null) { + example = "2013-10-20"; + } + example = "'" + escapeText(example) + "'"; + } else if ("DateTime".equalsIgnoreCase(type)) { + if (example == null) { + example = "2013-10-20T19:20:30+01:00"; + } + example = "'" + escapeText(example) + "'"; + } else if (!languageSpecificPrimitives.contains(type)) { + // type is a model class, e.g. User + example = this.packageName + "." + type + "()"; + } else { + LOGGER.debug("Type {} not handled properly in setParameterExampleValue", type); + } + + if (example == null) { + example = "None"; + } else if (Boolean.TRUE.equals(p.isArray)) { + example = "[" + example + "]"; + } else if (Boolean.TRUE.equals(p.isMap)) { + example = "{'key': " + example + "}"; + } + + p.example = example; + } + + @Override + public void setParameterExampleValue(CodegenParameter codegenParameter, Parameter parameter) { + Schema schema = parameter.getSchema(); + + if (parameter.getExample() != null) { + codegenParameter.example = parameter.getExample().toString(); + } else if (parameter.getExamples() != null && !parameter.getExamples().isEmpty()) { + Example example = parameter.getExamples().values().iterator().next(); + if (example.getValue() != null) { + codegenParameter.example = example.getValue().toString(); + } + } else if (schema != null && schema.getExample() != null) { + codegenParameter.example = schema.getExample().toString(); + } + + setParameterExampleValue(codegenParameter); + } + + @Override + public String sanitizeTag(String tag) { + return sanitizeName(tag); + } + + public String patternCorrection(String pattern) { + // Java does not recognize starting and ending forward slashes and mode modifiers + // It considers them as characters with no special meaning and tries to find them in the match string + boolean checkEnding = pattern.endsWith("/i") || pattern.endsWith("/g") || pattern.endsWith("/m"); + if (checkEnding) pattern = pattern.substring(0, pattern.length() - 2); + if (pattern.endsWith("/")) pattern = pattern.substring(0, pattern.length() - 1); + if (pattern.startsWith("/")) pattern = pattern.substring(1); + return pattern; + } + + public void setPackageName(String packageName) { + this.packageName = packageName; + additionalProperties.put(CodegenConstants.PACKAGE_NAME, this.packageName); + } + + public void setProjectName(String projectName) { + this.projectName = projectName; + } + + public void setPackageVersion(String packageVersion) { + this.packageVersion = packageVersion; + } + + @Override + public String getTypeDeclaration(Schema p) { + p = ModelUtils.unaliasSchema(openAPI, p); + + if (ModelUtils.isArraySchema(p)) { + ArraySchema ap = (ArraySchema) p; + Schema inner = ap.getItems(); + return getSchemaType(p) + "[" + getTypeDeclaration(inner) + "]"; + } else if (ModelUtils.isMapSchema(p)) { + Schema inner = ModelUtils.getAdditionalProperties(p); + return getSchemaType(p) + "[str, " + getTypeDeclaration(inner) + "]"; + } + + String openAPIType = getSchemaType(p); + if (typeMapping.containsKey(openAPIType)) { + return typeMapping.get(openAPIType); + } + + if (languageSpecificPrimitives.contains(openAPIType)) { + return openAPIType; + } + + return toModelName(openAPIType); + } + + @Override + public String getSchemaType(Schema p) { + String openAPIType = super.getSchemaType(p); + String type; + + if (openAPIType == null) { + LOGGER.error("OpenAPI Type for {} is null. Default to UNKNOWN_OPENAPI_TYPE instead.", p.getName()); + openAPIType = "UNKNOWN_OPENAPI_TYPE"; + } + + if (typeMapping.containsKey(openAPIType)) { + type = typeMapping.get(openAPIType); + if (type != null) { + return type; + } + } else { + type = openAPIType; + } + + return toModelName(type); + } + + @Override + public String toModelName(String name) { + // obtain the name from modelNameMapping directly if provided + if (modelNameMapping.containsKey(name)) { + return modelNameMapping.get(name); + } + + // check if schema-mapping has a different model for this class, so we can use it + // instead of the auto-generated one. + if (schemaMapping.containsKey(name)) { + return schemaMapping.get(name); + } + + // memoization + String origName = name; + if (schemaKeyToModelNameCache.containsKey(origName)) { + return schemaKeyToModelNameCache.get(origName); + } + + String sanitizedName = sanitizeName(name); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'. + // remove dollar sign + sanitizedName = sanitizedName.replace("$", ""); + // remove whitespace + sanitizedName = sanitizedName.replaceAll("\\s+", ""); + + String nameWithPrefixSuffix = sanitizedName; + if (!StringUtils.isEmpty(modelNamePrefix)) { + // add '_' so that model name can be camelized correctly + nameWithPrefixSuffix = modelNamePrefix + "_" + nameWithPrefixSuffix; + } + + if (!StringUtils.isEmpty(modelNameSuffix)) { + // add '_' so that model name can be camelized correctly + nameWithPrefixSuffix = nameWithPrefixSuffix + "_" + modelNameSuffix; + } + + // camelize the model name + // phone_number => PhoneNumber + String camelizedName = camelize(nameWithPrefixSuffix); + + // model name cannot use reserved keyword, e.g. return + if (isReservedWord(camelizedName)) { + String modelName = "Model" + camelizedName; // e.g. return => ModelReturn (after camelize) + LOGGER.warn("{} (reserved word) cannot be used as model name. Renamed to {}", camelizedName, modelName); + schemaKeyToModelNameCache.put(origName, modelName); + return modelName; + } + + // model name starts with number + if (camelizedName.matches("^\\d.*")) { + String modelName = "Model" + camelizedName; // e.g. return => ModelReturn (after camelize) + LOGGER.warn("{} (model name starts with number) cannot be used as model name. Renamed to {}", camelizedName, modelName); + schemaKeyToModelNameCache.put(origName, modelName); + return modelName; + } + + schemaKeyToModelNameCache.put(origName, camelizedName); + return camelizedName; + } + + @Override + public String toModelFilename(String name) { + // underscore the model file name + // PhoneNumber => phone_number + return underscore(dropDots(toModelName(name))); + } + + @Override + public String toModelTestFilename(String name) { + return "test_" + toModelFilename(name); + } + + @Override + public String toApiFilename(String name) { + // e.g. PhoneNumberApi.py => phone_number_api.py + return underscore(toApiName(name)); + } + + @Override + public String toApiTestFilename(String name) { + return "test_" + toApiFilename(name); + } + + @Override + public String toApiName(String name) { + return super.toApiName(name); + } + + @Override + public String toApiVarName(String name) { + return underscore(toApiName(name)); + } + + protected static String dropDots(String str) { + return str.replaceAll("\\.", "_"); + } + + @Override + public GeneratorLanguage generatorLanguage() { + return GeneratorLanguage.PYTHON; + } + + @Override + public Map postProcessAllModels(Map objs) { + final Map processed = super.postProcessAllModels(objs); + + for (Map.Entry entry : objs.entrySet()) { + // create hash map of codegen model + CodegenModel cm = ModelUtils.getModelByName(entry.getKey(), objs); + codegenModelMap.put(cm.classname, ModelUtils.getModelByName(entry.getKey(), objs)); + } + + // create circular import + for (String m : codegenModelMap.keySet()) { + createImportMapOfSet(m, codegenModelMap); + } + + for (Map.Entry entry : processed.entrySet()) { + entry.setValue(postProcessModelsMap(entry.getValue())); + } + + return processed; + } + + private ModelsMap postProcessModelsMap(ModelsMap objs) { + // process enum in models + objs = postProcessModelsEnum(objs); + + TreeSet typingImports = new TreeSet<>(); + TreeSet pydanticImports = new TreeSet<>(); + TreeSet datetimeImports = new TreeSet<>(); + TreeSet modelImports = new TreeSet<>(); + TreeSet postponedModelImports = new TreeSet<>(); + + for (ModelMap m : objs.getModels()) { + TreeSet exampleImports = new TreeSet<>(); + TreeSet postponedExampleImports = new TreeSet<>(); + List readOnlyFields = new ArrayList<>(); + hasModelsToImport = false; + int property_count = 1; + typingImports.clear(); + pydanticImports.clear(); + datetimeImports.clear(); + + CodegenModel model = m.getModel(); + + // handle null type in oneOf + if (model.getComposedSchemas() != null && model.getComposedSchemas().getOneOf() != null + && !model.getComposedSchemas().getOneOf().isEmpty()) { + int index = 0; + List oneOfs = model.getComposedSchemas().getOneOf(); + for (CodegenProperty oneOf : oneOfs) { + if ("none_type".equals(oneOf.dataType)) { + oneOfs.remove(index); + break; // return earlier assuming there's only 1 null type defined + } + index++; + } + } + + List codegenProperties = null; + if (!model.oneOf.isEmpty()) { // oneOfValidationError + codegenProperties = model.getComposedSchemas().getOneOf(); + typingImports.add("Any"); + typingImports.add("List"); + pydanticImports.add("Field"); + pydanticImports.add("StrictStr"); + pydanticImports.add("ValidationError"); + pydanticImports.add("validator"); + } else if (!model.anyOf.isEmpty()) { // anyOF + codegenProperties = model.getComposedSchemas().getAnyOf(); + pydanticImports.add("Field"); + pydanticImports.add("StrictStr"); + pydanticImports.add("ValidationError"); + pydanticImports.add("validator"); + } else { // typical model + codegenProperties = model.vars; + + // if super class + if (model.getDiscriminator() != null && model.getDiscriminator().getMappedModels() != null) { + typingImports.add("Union"); + Set discriminator = model.getDiscriminator().getMappedModels(); + for (CodegenDiscriminator.MappedModel mappedModel : discriminator) { + postponedModelImports.add(mappedModel.getMappingName()); + } + } + } + + if (!model.allOf.isEmpty()) { // allOf + for (CodegenProperty cp : model.allVars) { + if (!cp.isPrimitiveType || cp.isModel) { + if (cp.isArray){ // if array + modelImports.add(cp.items.dataType); + }else{ // if model + modelImports.add(cp.dataType); + } + } + } + } + + // if model_generic.mustache is used and support additionalProperties + if (model.oneOf.isEmpty() && model.anyOf.isEmpty() + && !model.isEnum + && !this.disallowAdditionalPropertiesIfNotPresent) { + typingImports.add("Dict"); + typingImports.add("Any"); + } + + //loop through properties/schemas to set up typing, pydantic + for (CodegenProperty cp : codegenProperties) { + String typing = getPydanticType(cp, typingImports, pydanticImports, datetimeImports, modelImports, exampleImports, postponedModelImports, postponedExampleImports, model.classname); + List fields = new ArrayList<>(); + String firstField = ""; + + // is readOnly? + if (cp.isReadOnly) { + readOnlyFields.add(cp.name); + } + + if (!cp.required) { //optional + firstField = "None"; + typing = "Optional[" + typing + "]"; + typingImports.add("Optional"); + } else { // required + firstField = "..."; + if (cp.isNullable) { + typing = "Optional[" + typing + "]"; + typingImports.add("Optional"); + } + } + + // field + if (cp.baseName != null && !cp.baseName.equals(cp.name)) { // base name not the same as name + fields.add(String.format(Locale.ROOT, "alias=\"%s\"", cp.baseName)); + } + + if (!StringUtils.isEmpty(cp.description)) { // has description + fields.add(String.format(Locale.ROOT, "description=\"%s\"", cp.description)); + } + + /* TODO review as example may break the build + if (!StringUtils.isEmpty(cp.getExample())) { // has example + fields.add(String.format(Locale.ROOT, "example=%s", cp.getExample())); + }*/ + + String fieldCustomization; + if ("None".equals(firstField)) { + if (cp.defaultValue == null) { + fieldCustomization = "None"; + } else { + if (cp.isArray || cp.isMap) { + // TODO handle default value for array/map + fieldCustomization = "None"; + } else { + fieldCustomization = cp.defaultValue; + } + } + } else { // required field + fieldCustomization = firstField; + } + + if (!fields.isEmpty()) { + fields.add(0, fieldCustomization); + pydanticImports.add("Field"); + fieldCustomization = String.format(Locale.ROOT, "Field(%s)", StringUtils.join(fields, ", ")); + } + + if ("...".equals(fieldCustomization)) { + // use Field() to avoid pylint warnings + pydanticImports.add("Field"); + fieldCustomization = "Field(...)"; + } + + cp.vendorExtensions.put("x-py-typing", typing + " = " + fieldCustomization); + + // setup x-py-name for each oneOf/anyOf schema + if (!model.oneOf.isEmpty()) { // oneOf + cp.vendorExtensions.put("x-py-name", String.format(Locale.ROOT, "oneof_schema_%d_validator", property_count++)); + } else if (!model.anyOf.isEmpty()) { // anyOf + cp.vendorExtensions.put("x-py-name", String.format(Locale.ROOT, "anyof_schema_%d_validator", property_count++)); + } + } + + // add parent model to import + if (!StringUtils.isEmpty(model.parent)) { + modelImports.add(model.parent); + } else if (!model.isEnum) { + pydanticImports.add("BaseModel"); + } + + // set enum type in extensions and update `name` in enumVars + if (model.isEnum) { + for (Map enumVars : (List>) model.getAllowableValues().get("enumVars")) { + if ((Boolean) enumVars.get("isString")) { + model.vendorExtensions.putIfAbsent("x-py-enum-type", "str"); + // update `name`, e.g. + enumVars.put("name", toEnumVariableName((String) enumVars.get("value"), "str")); + } else { + model.vendorExtensions.putIfAbsent("x-py-enum-type", "int"); + enumVars.put("name", toEnumVariableName((String) enumVars.get("value"), "int")); + } + } + } + + // set the extensions if the key is absent + model.getVendorExtensions().putIfAbsent("x-py-typing-imports", typingImports); + model.getVendorExtensions().putIfAbsent("x-py-pydantic-imports", pydanticImports); + model.getVendorExtensions().putIfAbsent("x-py-datetime-imports", datetimeImports); + model.getVendorExtensions().putIfAbsent("x-py-readonly", readOnlyFields); + + // import models one by one + if (!modelImports.isEmpty()) { + Set modelsToImport = new TreeSet<>(); + for (String modelImport : modelImports) { + if (modelImport.equals(model.classname)) { + // skip self import + continue; + } + modelsToImport.add("from " + packageName + ".models." + underscore(modelImport) + " import " + modelImport); + } + + model.getVendorExtensions().putIfAbsent("x-py-model-imports", modelsToImport); + } + + if (!postponedModelImports.isEmpty()) { + Set modelsToImport = new TreeSet<>(); + for (String modelImport : postponedModelImports) { + if (modelImport.equals(model.classname)) { + // skip self import + continue; + } + modelsToImport.add("from " + packageName + ".models." + underscore(modelImport) + " import " + modelImport); + } + + model.getVendorExtensions().putIfAbsent("x-py-postponed-model-imports", modelsToImport); + } + + } + + return objs; + } + + + /* + * Gets the pydantic type given a Codegen Parameter + * + * @param cp codegen parameter + * @param typingImports typing imports + * @param pydantic pydantic imports + * @param datetimeImports datetime imports + * @param modelImports model imports + * @param exampleImports example imports + * @param postponedModelImports postponed model imports + * @param postponedExampleImports postponed example imports + * @param classname class name + * @return pydantic type + * + */ + private String getPydanticType(CodegenParameter cp, + Set typingImports, + Set pydanticImports, + Set datetimeImports, + Set modelImports, + Set exampleImports, + Set postponedModelImports, + Set postponedExampleImports, + String classname) { + if (cp == null) { + // if codegen parameter (e.g. map/dict of undefined type) is null, default to string + LOGGER.warn("Codegen property is null (e.g. map/dict of undefined type). Default to typing.Any."); + typingImports.add("Any"); + return "Any"; + } + + if (cp.isArray) { + String constraints = ""; + if (cp.maxItems != null) { + constraints += String.format(Locale.ROOT, ", max_items=%d", cp.maxItems); + } + if (cp.minItems != null) { + constraints += String.format(Locale.ROOT, ", min_items=%d", cp.minItems); + } + if (cp.getUniqueItems()) { + constraints += ", unique_items=True"; + } + pydanticImports.add("conlist"); + return String.format(Locale.ROOT, "conlist(%s%s)", + getPydanticType(cp.items, typingImports, pydanticImports, datetimeImports, modelImports, exampleImports, postponedModelImports, postponedExampleImports, classname), + constraints); + } else if (cp.isMap) { + typingImports.add("Dict"); + return String.format(Locale.ROOT, "Dict[str, %s]", + getPydanticType(cp.items, typingImports, pydanticImports, datetimeImports, modelImports, exampleImports, postponedModelImports, postponedExampleImports, classname)); + } else if (cp.isString) { + if (cp.hasValidation) { + List fieldCustomization = new ArrayList<>(); + // e.g. constr(regex=r'/[a-z]/i', strict=True) + fieldCustomization.add("strict=True"); + if (cp.getMaxLength() != null) { + fieldCustomization.add("max_length=" + cp.getMaxLength()); + } + if (cp.getMinLength() != null) { + fieldCustomization.add("min_length=" + cp.getMinLength()); + } + if (cp.getPattern() != null) { + pydanticImports.add("validator"); + // use validator instead as regex doesn't support flags, e.g. IGNORECASE + //fieldCustomization.add(String.format(Locale.ROOT, "regex=r'%s'", cp.getPattern())); + } + pydanticImports.add("constr"); + return String.format(Locale.ROOT, "constr(%s)", StringUtils.join(fieldCustomization, ", ")); + } else { + if ("password".equals(cp.getFormat())) { // TDOO avoid using format, use `is` boolean flag instead + pydanticImports.add("SecretStr"); + return "SecretStr"; + } else { + pydanticImports.add("StrictStr"); + return "StrictStr"; + } + } + } else if (cp.isNumber || cp.isFloat || cp.isDouble) { + if (cp.hasValidation) { + List fieldCustomization = new ArrayList<>(); + List intFieldCustomization = new ArrayList<>(); + + // e.g. confloat(ge=10, le=100, strict=True) + if (cp.getMaximum() != null) { + if (cp.getExclusiveMaximum()) { + fieldCustomization.add("lt=" + cp.getMaximum()); + intFieldCustomization.add("lt=" + Math.ceil(Double.valueOf(cp.getMaximum()))); // e.g. < 7.59 becomes < 8 + } else { + fieldCustomization.add("le=" + cp.getMaximum()); + intFieldCustomization.add("le=" + Math.floor(Double.valueOf(cp.getMaximum()))); // e.g. <= 7.59 becomes <= 7 + } + } + if (cp.getMinimum() != null) { + if (cp.getExclusiveMinimum()) { + fieldCustomization.add("gt=" + cp.getMinimum()); + intFieldCustomization.add("gt=" + Math.floor(Double.valueOf(cp.getMinimum()))); // e.g. > 7.59 becomes > 7 + } else { + fieldCustomization.add("ge=" + cp.getMinimum()); + intFieldCustomization.add("ge=" + Math.ceil(Double.valueOf(cp.getMinimum()))); // e.g. >= 7.59 becomes >= 8 + } + } + if (cp.getMultipleOf() != null) { + fieldCustomization.add("multiple_of=" + cp.getMultipleOf()); + } + + if ("Union[StrictFloat, StrictInt]".equals(mapNumberTo)) { + fieldCustomization.add("strict=True"); + intFieldCustomization.add("strict=True"); + pydanticImports.add("confloat"); + pydanticImports.add("conint"); + typingImports.add("Union"); + return String.format(Locale.ROOT, "Union[%s(%s), %s(%s)]", "confloat", + StringUtils.join(fieldCustomization, ", "), + "conint", + StringUtils.join(intFieldCustomization, ", ") + ); + } else if ("StrictFloat".equals(mapNumberTo)) { + fieldCustomization.add("strict=True"); + pydanticImports.add("confloat"); + return String.format(Locale.ROOT, "%s(%s)", "confloat", + StringUtils.join(fieldCustomization, ", ")); + } else { // float + pydanticImports.add("confloat"); + return String.format(Locale.ROOT, "%s(%s)", "confloat", + StringUtils.join(fieldCustomization, ", ")); + } + } else { + if ("Union[StrictFloat, StrictInt]".equals(mapNumberTo)) { + typingImports.add("Union"); + pydanticImports.add("StrictFloat"); + pydanticImports.add("StrictInt"); + return "Union[StrictFloat, StrictInt]"; + } else if ("StrictFloat".equals(mapNumberTo)) { + pydanticImports.add("StrictFloat"); + return "StrictFloat"; + } else { + return "float"; + } + } + } else if (cp.isInteger || cp.isLong || cp.isShort || cp.isUnboundedInteger) { + if (cp.hasValidation) { + List fieldCustomization = new ArrayList<>(); + // e.g. conint(ge=10, le=100, strict=True) + fieldCustomization.add("strict=True"); + if (cp.getMaximum() != null) { + if (cp.getExclusiveMaximum()) { + fieldCustomization.add("lt=" + cp.getMaximum()); + } else { + fieldCustomization.add("le=" + cp.getMaximum()); + } + } + if (cp.getMinimum() != null) { + if (cp.getExclusiveMinimum()) { + fieldCustomization.add("gt=" + cp.getMinimum()); + } else { + fieldCustomization.add("ge=" + cp.getMinimum()); + } + } + if (cp.getMultipleOf() != null) { + fieldCustomization.add("multiple_of=" + cp.getMultipleOf()); + } + + pydanticImports.add("conint"); + return String.format(Locale.ROOT, "%s(%s)", "conint", + StringUtils.join(fieldCustomization, ", ")); + } else { + pydanticImports.add("StrictInt"); + return "StrictInt"; + } + } else if (cp.isBinary || cp.isByteArray) { + if (cp.hasValidation) { + List fieldCustomization = new ArrayList<>(); + // e.g. conbytes(min_length=2, max_length=10) + fieldCustomization.add("strict=True"); + if (cp.getMinLength() != null) { + fieldCustomization.add("min_length=" + cp.getMinLength()); + } + if (cp.getMaxLength() != null) { + fieldCustomization.add("max_length=" + cp.getMaxLength()); + } + if (cp.getPattern() != null) { + pydanticImports.add("validator"); + // use validator instead as regex doesn't support flags, e.g. IGNORECASE + //fieldCustomization.add(Locale.ROOT, String.format(Locale.ROOT, "regex=r'%s'", cp.getPattern())); + } + + pydanticImports.add("conbytes"); + pydanticImports.add("constr"); + typingImports.add("Union"); + return String.format(Locale.ROOT, "Union[conbytes(%s), constr(% fieldCustomization = new ArrayList<>(); + // e.g. condecimal(ge=10, le=100, strict=True) + fieldCustomization.add("strict=True"); + if (cp.getMaximum() != null) { + if (cp.getExclusiveMaximum()) { + fieldCustomization.add("gt=" + cp.getMaximum()); + } else { + fieldCustomization.add("ge=" + cp.getMaximum()); + } + } + if (cp.getMinimum() != null) { + if (cp.getExclusiveMinimum()) { + fieldCustomization.add("lt=" + cp.getMinimum()); + } else { + fieldCustomization.add("le=" + cp.getMinimum()); + } + } + if (cp.getMultipleOf() != null) { + fieldCustomization.add("multiple_of=" + cp.getMultipleOf()); + } + pydanticImports.add("condecimal"); + return String.format(Locale.ROOT, "%s(%s)", "condecimal", StringUtils.join(fieldCustomization, ", ")); + } else { + pydanticImports.add("condecimal"); + return "condecimal()"; + } + } else if (cp.getIsAnyType()) { + typingImports.add("Any"); + return "Any"; + } else if (cp.isDate || cp.isDateTime) { + if (cp.isDate) { + datetimeImports.add("date"); + } + if (cp.isDateTime) { + datetimeImports.add("datetime"); + } + + return cp.dataType; + } else if (cp.isUuid) { + return cp.dataType; + } else if (cp.isFreeFormObject) { // type: object + typingImports.add("Dict"); + typingImports.add("Any"); + return "Dict[str, Any]"; + } else if (!cp.isPrimitiveType) { + // add model prefix + hasModelsToImport = true; + modelImports.add(cp.dataType); + exampleImports.add(cp.dataType); + return cp.dataType; + } else if (cp.getContent() != null) { + LinkedHashMap contents = cp.getContent(); + for (String key : contents.keySet()) { + CodegenMediaType cmt = contents.get(key); + // TODO process the first one only at the moment + if (cmt != null) + return getPydanticType(cmt.getSchema(), typingImports, pydanticImports, datetimeImports, modelImports, exampleImports, postponedModelImports, postponedExampleImports, classname); + } + throw new RuntimeException("Error! Failed to process getPydanticType when getting the content: " + cp); + } else { + throw new RuntimeException("Error! Codegen Parameter not yet supported in getPydanticType: " + cp); + } + } + + + /* + * Gets the pydantic type given a Codegen Property + * + * @param cp codegen property + * @param typingImports typing imports + * @param pydantic pydantic imports + * @param datetimeImports datetime imports + * @param modelImports model imports + * @param exampleImports example imports + * @param postponedModelImports postponed model imports + * @param postponedExampleImports postponed example imports + * @param classname class name + * @return pydantic type + * + */ + private String getPydanticType(CodegenProperty cp, + Set typingImports, + Set pydanticImports, + Set datetimeImports, + Set modelImports, + Set exampleImports, + Set postponedModelImports, + Set postponedExampleImports, + String classname) { + if (cp == null) { + // if codegen property (e.g. map/dict of undefined type) is null, default to string + LOGGER.warn("Codegen property is null (e.g. map/dict of undefined type). Default to typing.Any."); + typingImports.add("Any"); + return "Any"; + } + + if (cp.isEnum) { + pydanticImports.add("validator"); + } + + /* comment out the following since Literal requires python 3.8 + also need to put cp.isEnum check after isArray, isMap check + if (cp.isEnum) { + // use Literal for inline enum + typingImports.add("Literal"); + List values = new ArrayList<>(); + List> enumVars = (List>) cp.allowableValues.get("enumVars"); + if (enumVars != null) { + for (Map enumVar : enumVars) { + values.add((String) enumVar.get("value")); + } + } + return String.format(Locale.ROOT, "%sEnum", cp.nameInCamelCase); + } else*/ + if (cp.isArray) { + String constraints = ""; + if (cp.maxItems != null) { + constraints += String.format(Locale.ROOT, ", max_items=%d", cp.maxItems); + } + if (cp.minItems != null) { + constraints += String.format(Locale.ROOT, ", min_items=%d", cp.minItems); + } + if (cp.getUniqueItems()) { + constraints += ", unique_items=True"; + } + pydanticImports.add("conlist"); + typingImports.add("List"); // for return type + return String.format(Locale.ROOT, "conlist(%s%s)", + getPydanticType(cp.items, typingImports, pydanticImports, datetimeImports, modelImports, exampleImports, postponedModelImports, postponedExampleImports, classname), + constraints); + } else if (cp.isMap) { + typingImports.add("Dict"); + return String.format(Locale.ROOT, "Dict[str, %s]", getPydanticType(cp.items, typingImports, pydanticImports, datetimeImports, modelImports, exampleImports, postponedModelImports, postponedExampleImports, classname)); + } else if (cp.isString) { + if (cp.hasValidation) { + List fieldCustomization = new ArrayList<>(); + // e.g. constr(regex=r'/[a-z]/i', strict=True) + fieldCustomization.add("strict=True"); + if (cp.getMaxLength() != null) { + fieldCustomization.add("max_length=" + cp.getMaxLength()); + } + if (cp.getMinLength() != null) { + fieldCustomization.add("min_length=" + cp.getMinLength()); + } + if (cp.getPattern() != null) { + pydanticImports.add("validator"); + // use validator instead as regex doesn't support flags, e.g. IGNORECASE + //fieldCustomization.add(Locale.ROOT, String.format(Locale.ROOT, "regex=r'%s'", cp.getPattern())); + } + pydanticImports.add("constr"); + return String.format(Locale.ROOT, "constr(%s)", StringUtils.join(fieldCustomization, ", ")); + } else { + if ("password".equals(cp.getFormat())) { // TDOO avoid using format, use `is` boolean flag instead + pydanticImports.add("SecretStr"); + return "SecretStr"; + } else { + pydanticImports.add("StrictStr"); + return "StrictStr"; + } + } + } else if (cp.isNumber || cp.isFloat || cp.isDouble) { + if (cp.hasValidation) { + List fieldCustomization = new ArrayList<>(); + List intFieldCustomization = new ArrayList<>(); + + // e.g. confloat(ge=10, le=100, strict=True) + if (cp.getMaximum() != null) { + if (cp.getExclusiveMaximum()) { + fieldCustomization.add("lt=" + cp.getMaximum()); + intFieldCustomization.add("lt=" + (int) Math.ceil(Double.valueOf(cp.getMaximum()))); // e.g. < 7.59 => < 8 + } else { + fieldCustomization.add("le=" + cp.getMaximum()); + intFieldCustomization.add("le=" + (int) Math.floor(Double.valueOf(cp.getMaximum()))); // e.g. <= 7.59 => <= 7 + } + } + if (cp.getMinimum() != null) { + if (cp.getExclusiveMinimum()) { + fieldCustomization.add("gt=" + cp.getMinimum()); + intFieldCustomization.add("gt=" + (int) Math.floor(Double.valueOf(cp.getMinimum()))); // e.g. > 7.59 => > 7 + } else { + fieldCustomization.add("ge=" + cp.getMinimum()); + intFieldCustomization.add("ge=" + (int) Math.ceil(Double.valueOf(cp.getMinimum()))); // e.g. >= 7.59 => >= 8 + } + } + if (cp.getMultipleOf() != null) { + fieldCustomization.add("multiple_of=" + cp.getMultipleOf()); + } + + if ("Union[StrictFloat, StrictInt]".equals(mapNumberTo)) { + fieldCustomization.add("strict=True"); + intFieldCustomization.add("strict=True"); + pydanticImports.add("confloat"); + pydanticImports.add("conint"); + typingImports.add("Union"); + return String.format(Locale.ROOT, "Union[%s(%s), %s(%s)]", "confloat", + StringUtils.join(fieldCustomization, ", "), + "conint", + StringUtils.join(intFieldCustomization, ", ") + ); + } else if ("StrictFloat".equals(mapNumberTo)) { + fieldCustomization.add("strict=True"); + pydanticImports.add("confloat"); + return String.format(Locale.ROOT, "%s(%s)", "confloat", + StringUtils.join(fieldCustomization, ", ")); + } else { // float + pydanticImports.add("confloat"); + return String.format(Locale.ROOT, "%s(%s)", "confloat", + StringUtils.join(fieldCustomization, ", ")); + } + } else { + if ("Union[StrictFloat, StrictInt]".equals(mapNumberTo)) { + typingImports.add("Union"); + pydanticImports.add("StrictFloat"); + pydanticImports.add("StrictInt"); + return "Union[StrictFloat, StrictInt]"; + } else if ("StrictFloat".equals(mapNumberTo)) { + pydanticImports.add("StrictFloat"); + return "StrictFloat"; + } else { + return "float"; + } + } + } else if (cp.isInteger || cp.isLong || cp.isShort || cp.isUnboundedInteger) { + if (cp.hasValidation) { + List fieldCustomization = new ArrayList<>(); + // e.g. conint(ge=10, le=100, strict=True) + fieldCustomization.add("strict=True"); + if (cp.getMaximum() != null) { + if (cp.getExclusiveMaximum()) { + fieldCustomization.add("lt=" + cp.getMaximum()); + } else { + fieldCustomization.add("le=" + cp.getMaximum()); + } + } + if (cp.getMinimum() != null) { + if (cp.getExclusiveMinimum()) { + fieldCustomization.add("gt=" + cp.getMinimum()); + } else { + fieldCustomization.add("ge=" + cp.getMinimum()); + } + } + if (cp.getMultipleOf() != null) { + fieldCustomization.add("multiple_of=" + cp.getMultipleOf()); + } + + pydanticImports.add("conint"); + return String.format(Locale.ROOT, "%s(%s)", "conint", + StringUtils.join(fieldCustomization, ", ")); + } else { + pydanticImports.add("StrictInt"); + return "StrictInt"; + } + } else if (cp.isBinary || cp.isByteArray) { + if (cp.hasValidation) { + List fieldCustomization = new ArrayList<>(); + // e.g. conbytes(min_length=2, max_length=10) + fieldCustomization.add("strict=True"); + if (cp.getMinLength() != null) { + fieldCustomization.add("min_length=" + cp.getMinLength()); + } + if (cp.getMaxLength() != null) { + fieldCustomization.add("max_length=" + cp.getMaxLength()); + } + if (cp.getPattern() != null) { + pydanticImports.add("validator"); + // use validator instead as regex doesn't support flags, e.g. IGNORECASE + //fieldCustomization.add(Locale.ROOT, String.format(Locale.ROOT, "regex=r'%s'", cp.getPattern())); + } + + pydanticImports.add("conbytes"); + pydanticImports.add("constr"); + typingImports.add("Union"); + return String.format(Locale.ROOT, "Union[conbytes(%s), constr(% fieldCustomization = new ArrayList<>(); + // e.g. condecimal(ge=10, le=100, strict=True) + fieldCustomization.add("strict=True"); + if (cp.getMaximum() != null) { + if (cp.getExclusiveMaximum()) { + fieldCustomization.add("gt=" + cp.getMaximum()); + } else { + fieldCustomization.add("ge=" + cp.getMaximum()); + } + } + if (cp.getMinimum() != null) { + if (cp.getExclusiveMinimum()) { + fieldCustomization.add("lt=" + cp.getMinimum()); + } else { + fieldCustomization.add("le=" + cp.getMinimum()); + } + } + if (cp.getMultipleOf() != null) { + fieldCustomization.add("multiple_of=" + cp.getMultipleOf()); + } + pydanticImports.add("condecimal"); + return String.format(Locale.ROOT, "%s(%s)", "condecimal", StringUtils.join(fieldCustomization, ", ")); + } else { + pydanticImports.add("condecimal"); + return "condecimal()"; + } + } else if (cp.getIsAnyType()) { + typingImports.add("Any"); + return "Any"; + } else if (cp.isDate || cp.isDateTime) { + if (cp.isDate) { + datetimeImports.add("date"); + } + if (cp.isDateTime) { + datetimeImports.add("datetime"); + } + return cp.dataType; + } else if (cp.isUuid) { + return cp.dataType; + } else if (cp.isFreeFormObject) { // type: object + typingImports.add("Dict"); + typingImports.add("Any"); + return "Dict[str, Any]"; + } else if (!cp.isPrimitiveType || cp.isModel) { // model + // skip import if it's a circular reference + if (classname == null) { + // for parameter model, import directly + hasModelsToImport = true; + modelImports.add(cp.dataType); + exampleImports.add(cp.dataType); + } else { + if (circularImports.containsKey(cp.dataType)) { + if (circularImports.get(cp.dataType).contains(classname)) { + hasModelsToImport = true; + postponedModelImports.add(cp.dataType); + postponedExampleImports.add(cp.dataType); + // cp.dataType import map of set contains this model (classname), don't import + LOGGER.debug("Skipped importing {} in {} due to circular import.", cp.dataType, classname); + } else { + // not circular import, so ok to import it + hasModelsToImport = true; + modelImports.add(cp.dataType); + exampleImports.add(cp.dataType); + } + } else { + LOGGER.error("Failed to look up {} from the imports (map of set) of models.", cp.dataType); + } + } + return cp.dataType; + } else { + throw new RuntimeException("Error! Codegen Property not yet supported in getPydanticType: " + cp); + } + } + + public void setMapNumberTo(String mapNumberTo) { + if ("Union[StrictFloat, StrictInt]".equals(mapNumberTo) + || "StrictFloat".equals(mapNumberTo) + || "float".equals(mapNumberTo)) { + this.mapNumberTo = mapNumberTo; + } else { + throw new IllegalArgumentException("mapNumberTo value must be Union[StrictFloat, StrictInt], StrictStr or float"); + } + } + + public String toEnumVariableName(String name, String datatype) { + if ("int".equals(datatype)) { + return "NUMBER_" + name.replace("-", "MINUS_"); + } + + // remove quote e.g. 'abc' => abc + name = name.substring(1, name.length() - 1); + + if (name.length() == 0) { + return "EMPTY"; + } + + if (" ".equals(name)) { + return "SPACE"; + } + + if ("_".equals(name)) { + return "UNDERSCORE"; + } + + if (reservedWords.contains(name)) { + name = name.toUpperCase(Locale.ROOT); + } else if (((CharSequence) name).chars().anyMatch(character -> specialCharReplacements.keySet().contains(String.valueOf((char) character)))) { + name = underscore(escape(name, specialCharReplacements, Collections.singletonList("_"), "_")).toUpperCase(Locale.ROOT); + } else { + name = name.toUpperCase(Locale.ROOT); + } + + name = name.replace(" ", "_"); + name = name.replaceFirst("^_", ""); + name = name.replaceFirst("_$", ""); + + if (name.matches("\\d.*")) { + name = "ENUM_" + name.toUpperCase(Locale.ROOT); + } + + return name; + } + + /** + * Update circularImports with the model name (key) and its imports gathered recursively + * + * @param modelName model name + * @param codegenModelMap a map of CodegenModel + */ + void createImportMapOfSet(String modelName, Map codegenModelMap) { + HashSet imports = new HashSet<>(); + circularImports.put(modelName, imports); + + CodegenModel cm = codegenModelMap.get(modelName); + + if (cm == null) { + LOGGER.warn("Failed to lookup model in createImportMapOfSet: " + modelName); + return; + } + + List codegenProperties = null; + if (cm.oneOf != null && !cm.oneOf.isEmpty()) { // oneOf + codegenProperties = cm.getComposedSchemas().getOneOf(); + } else if (cm.anyOf != null && !cm.anyOf.isEmpty()) { // anyOF + codegenProperties = cm.getComposedSchemas().getAnyOf(); + } else { // typical model + codegenProperties = cm.vars; + } + + for (CodegenProperty cp : codegenProperties) { + String modelNameFromDataType = getModelNameFromDataType(cp); + if (modelNameFromDataType != null) { // model + imports.add(modelNameFromDataType); // update import + // go through properties or sub-schemas of the model recursively to identify more (model) import if any + updateImportsFromCodegenModel(modelNameFromDataType, codegenModelMap.get(modelNameFromDataType), imports); + } + } + } + + /** + * Returns the model name (if any) from data type of codegen property. + * Returns null if it's not a model. + * + * @param cp Codegen property + * @return model name + */ + private String getModelNameFromDataType(CodegenProperty cp) { + if (cp.isArray) { + return getModelNameFromDataType(cp.items); + } else if (cp.isMap) { + return getModelNameFromDataType(cp.items); + } else if (!cp.isPrimitiveType || cp.isModel) { + return cp.dataType; + } else { + return null; + } + } + + /** + * Update set of imports from codegen model recursivly + * + * @param modelName model name + * @param cm codegen model + * @param imports set of imports + */ + public void updateImportsFromCodegenModel(String modelName, CodegenModel cm, Set imports) { + if (cm == null) { + LOGGER.warn("Failed to lookup model in createImportMapOfSet " + modelName); + return; + } + + List codegenProperties = null; + if (cm.oneOf != null && !cm.oneOf.isEmpty()) { // oneOfValidationError + codegenProperties = cm.getComposedSchemas().getOneOf(); + } else if (cm.anyOf != null && !cm.anyOf.isEmpty()) { // anyOF + codegenProperties = cm.getComposedSchemas().getAnyOf(); + } else { // typical model + codegenProperties = cm.vars; + } + + for (CodegenProperty cp : codegenProperties) { + String modelNameFromDataType = getModelNameFromDataType(cp); + if (modelNameFromDataType != null) { // model + if (modelName.equals(modelNameFromDataType)) { // self referencing + continue; + } else if (imports.contains(modelNameFromDataType)) { // circular import + continue; + } else { + imports.add(modelNameFromDataType); // update import + // go through properties of the model recursively to identify more (model) import if any + updateImportsFromCodegenModel(modelNameFromDataType, codegenModelMap.get(modelNameFromDataType), imports); + } + } + } + } + + @Override + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + hasModelsToImport = false; + boolean importAnnotated = false; + TreeSet typingImports = new TreeSet<>(); + TreeSet pydanticImports = new TreeSet<>(); + TreeSet datetimeImports = new TreeSet<>(); + TreeSet modelImports = new TreeSet<>(); + TreeSet postponedModelImports = new TreeSet<>(); + + OperationMap objectMap = objs.getOperations(); + List operations = objectMap.getOperation(); + for (CodegenOperation operation : operations) { + TreeSet exampleImports = new TreeSet<>(); // import for each operation to be show in sample code + TreeSet postponedExampleImports = new TreeSet<>(); // import for each operation to be show in sample code + List params = operation.allParams; + + for (CodegenParameter param : params) { + String typing = getPydanticType(param, typingImports, pydanticImports, datetimeImports, modelImports, exampleImports, postponedModelImports, postponedExampleImports, null); + List fields = new ArrayList<>(); + String firstField = ""; + + if (!param.required) { //optional + firstField = "None"; + typing = "Optional[" + typing + "]"; + typingImports.add("Optional"); + } else { // required + firstField = "..."; + if (param.isNullable) { + typing = "Optional[" + typing + "]"; + typingImports.add("Optional"); + } + } + + if (!StringUtils.isEmpty(param.description)) { // has description + fields.add(String.format(Locale.ROOT, "description=\"%s\"", param.description)); + } + + /* TODO support example + if (!StringUtils.isEmpty(cp.getExample())) { // has example + fields.add(String.format(Locale.ROOT, "example=%s", cp.getExample())); + }*/ + + String fieldCustomization; + if ("None".equals(firstField)) { + fieldCustomization = null; + } else { // required field + fieldCustomization = firstField; + } + + if (!fields.isEmpty()) { + if (fieldCustomization != null) { + fields.add(0, fieldCustomization); + } + pydanticImports.add("Field"); + fieldCustomization = String.format(Locale.ROOT, "Field(%s)", StringUtils.join(fields, ", ")); + } else { + fieldCustomization = "Field()"; + } + + if ("Field()".equals(fieldCustomization)) { + param.vendorExtensions.put("x-py-typing", typing); + } else { + param.vendorExtensions.put("x-py-typing", String.format(Locale.ROOT, "Annotated[%s, %s]", typing, fieldCustomization)); + importAnnotated = true; + } + } + + // update typing import for operation return type + if (!StringUtils.isEmpty(operation.returnType)) { + String typing = getPydanticType(operation.returnProperty, typingImports, + new TreeSet<>() /* skip pydantic import for return type */, datetimeImports, modelImports, exampleImports, postponedModelImports, postponedExampleImports, null); + } + + // add import for code samples + // import models one by one + if (!exampleImports.isEmpty()) { + List imports = new ArrayList<>(); + for (String exampleImport : exampleImports) { + imports.add("from " + packageName + ".models." + underscore(exampleImport) + " import " + exampleImport); + } + operation.vendorExtensions.put("x-py-example-import", imports); + } + + if (!postponedExampleImports.isEmpty()) { + List imports = new ArrayList<>(); + for (String exampleImport : postponedExampleImports) { + imports.add("from " + packageName + ".models." + underscore(exampleImport) + " import " + + exampleImport); + } + operation.vendorExtensions.put("x-py-example-import", imports); + } + } + + List> newImports = new ArrayList<>(); + + if (importAnnotated) { + Map item = new HashMap<>(); + item.put("import", String.format(Locale.ROOT, String.format(Locale.ROOT, "from typing_extensions import Annotated"))); + newImports.add(item); + } + + // need datetime import + if (!datetimeImports.isEmpty()) { + Map item = new HashMap<>(); + item.put("import", String.format(Locale.ROOT, "from datetime import %s\n", StringUtils.join(datetimeImports, ", "))); + newImports.add(item); + } + + // need pydantic imports + if (!pydanticImports.isEmpty()) { + Map item = new HashMap<>(); + item.put("import", String.format(Locale.ROOT, "from pydantic import %s\n", StringUtils.join(pydanticImports, ", "))); + newImports.add(item); + } + + // need typing imports + if (!typingImports.isEmpty()) { + Map item = new HashMap<>(); + item.put("import", String.format(Locale.ROOT, "from typing import %s\n", StringUtils.join(typingImports, ", "))); + newImports.add(item); + } + + // import models one by one + if (!modelImports.isEmpty()) { + for (String modelImport : modelImports) { + Map item = new HashMap<>(); + item.put("import", "from " + packageName + ".models." + underscore(modelImport) + " import " + modelImport); + newImports.add(item); + } + } + + if (!postponedModelImports.isEmpty()) { + for (String modelImport : postponedModelImports) { + Map item = new HashMap<>(); + item.put("import", "from " + packageName + ".models." + underscore(modelImport) + " import " + modelImport); + newImports.add(item); + } + } + + // reset imports with newImports + objs.setImports(newImports); + return objs; + } + + + @Override + public void postProcessParameter(CodegenParameter parameter) { + postProcessPattern(parameter.pattern, parameter.vendorExtensions); + } + + @Override + public void postProcessModelProperty(CodegenModel model, CodegenProperty property) { + postProcessPattern(property.pattern, property.vendorExtensions); + } + + /* + * The OpenAPI pattern spec follows the Perl convention and style of modifiers. Python + * does not support this in as natural a way so it needs to convert it. See + * https://docs.python.org/2/howto/regex.html#compilation-flags for details. + * + * @param pattern (the String pattern to convert from python to Perl convention) + * @param vendorExtensions (list of custom x-* properties for extra functionality-see https://swagger.io/docs/specification/openapi-extensions/) + * @return void + * @throws IllegalArgumentException if pattern does not follow the Perl /pattern/modifiers convention + * + * Includes fix for issue #6675 + */ + public void postProcessPattern(String pattern, Map vendorExtensions) { + if (pattern != null) { + int i = pattern.lastIndexOf('/'); + + // TOOD update the check below follow python convention + //Must follow Perl /pattern/modifiers convention + if (pattern.charAt(0) != '/' || i < 2) { + throw new IllegalArgumentException("Pattern must follow the Perl " + + "/pattern/modifiers convention. " + pattern + " is not valid."); + } + + String regex = pattern.substring(1, i).replace("'", "\\'"); + List modifiers = new ArrayList(); + + for (char c : pattern.substring(i).toCharArray()) { + if (regexModifiers.containsKey(c)) { + String modifier = regexModifiers.get(c); + modifiers.add(modifier); + } + } + + vendorExtensions.put("x-regex", regex.replace("\"", "\\\"")); + vendorExtensions.put("x-pattern", pattern.replace("\"", "\\\"")); + vendorExtensions.put("x-modifiers", modifiers); + } + } + + @Override + public String addRegularExpressionDelimiter(String pattern) { + if (StringUtils.isEmpty(pattern)) { + return pattern; + } + + if (!pattern.matches("^/.*")) { + // Perform a negative lookbehind on each `/` to ensure that it is escaped. + return "/" + pattern.replaceAll("(? expected = new ArrayList<>(Arrays.asList("A", "B", "C")); + assert prop.getNullable(); + assert prop.getEnum().equals(expected); + } + + @Test(description = "test regex patterns") + public void testRegularExpressionOpenAPISchemaVersion3() { + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/issue_1517.yaml"); + final PythonPydanticV1ClientCodegen codegen = new PythonPydanticV1ClientCodegen(); + codegen.setOpenAPI(openAPI); + final String path = "/ping"; + final Operation p = openAPI.getPaths().get(path).getGet(); + final CodegenOperation op = codegen.fromOperation(path, "get", p, null); + // pattern_no_forward_slashes '^pattern$' + Assert.assertEquals(op.allParams.get(0).pattern, "/^pattern$/"); + // pattern_two_slashes '/^pattern$/' + Assert.assertEquals(op.allParams.get(1).pattern, "/^pattern$/"); + // pattern_dont_escape_backslash '/^pattern\d{3}$/' + Assert.assertEquals(op.allParams.get(2).pattern, "/^pattern\\d{3}$/"); + // pattern_dont_escape_escaped_forward_slash '/^pattern\/\d{3}$/' + Assert.assertEquals(op.allParams.get(3).pattern, "/^pattern\\/\\d{3}$/"); + // pattern_escape_unescaped_forward_slash '^pattern/\d{3}$' + Assert.assertEquals(op.allParams.get(4).pattern, "/^pattern\\/\\d{3}$/"); + // pattern_with_modifiers '/^pattern\d{3}$/i + Assert.assertEquals(op.allParams.get(5).pattern, "/^pattern\\d{3}$/i"); + // pattern_with_backslash_after_bracket '/^[\pattern\d{3}$/i' + // added to test fix for issue #6675 + // removed because "/^[\\pattern\\d{3}$/i" is invalid regex because [ is not escaped and there is no closing ] + // Assert.assertEquals(op.allParams.get(6).pattern, "/^[\\pattern\\d{3}$/i"); + + } + + + @Test(description = "test generated example values for string properties") + public void testGeneratedExampleValues() { + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/examples.yaml"); + final PythonPydanticV1ClientCodegen codegen = new PythonPydanticV1ClientCodegen(); + codegen.setOpenAPI(openAPI); + final Schema dummyUserSchema = openAPI.getComponents().getSchemas().get("DummyUser"); + final Schema nameSchema = (Schema) dummyUserSchema.getProperties().get("name"); + final Schema numberSchema = (Schema) dummyUserSchema.getProperties().get("number"); + final Schema addressSchema = (Schema) dummyUserSchema.getProperties().get("address"); + final String namePattern = codegen.patternCorrection(nameSchema.getPattern()); + final String numberPattern = codegen.patternCorrection(numberSchema.getPattern()); + final String addressPattern = codegen.patternCorrection(addressSchema.getPattern()); + Assert.assertTrue(codegen.escapeQuotationMark(codegen.toExampleValue(nameSchema)).matches(namePattern)); + Assert.assertTrue(codegen.escapeQuotationMark(codegen.toExampleValue(numberSchema)).matches(numberPattern)); + Assert.assertTrue(codegen.escapeQuotationMark(codegen.toExampleValue(addressSchema)).matches(addressPattern)); + } + + @Test(description = "test single quotes escape") + public void testSingleQuotes() { + final PythonPydanticV1ClientCodegen codegen = new PythonPydanticV1ClientCodegen(); + StringSchema schema = new StringSchema(); + schema.setDefault("Text containing 'single' quote"); + String defaultValue = codegen.toDefaultValue(schema); + Assert.assertEquals("'Text containing \'single\' quote'", defaultValue); + } + + @Test(description = "test backslash default") + public void testBackslashDefault() { + final PythonPydanticV1ClientCodegen codegen = new PythonPydanticV1ClientCodegen(); + StringSchema schema = new StringSchema(); + schema.setDefault("\\"); + String defaultValue = codegen.toDefaultValue(schema); + Assert.assertEquals("'\\\\'", defaultValue); + } + + @Test(description = "convert a python model with dots") + public void modelTest() { + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/v1beta3.yaml"); + final DefaultCodegen codegen = new PythonPydanticV1ClientCodegen(); + codegen.setOpenAPI(openAPI); + + codegen.setOpenAPI(openAPI); + final CodegenModel simpleName = codegen.fromModel("v1beta3.Binding", openAPI.getComponents().getSchemas().get("v1beta3.Binding")); + Assert.assertEquals(simpleName.name, "v1beta3.Binding"); + Assert.assertEquals(simpleName.classname, "V1beta3Binding"); + Assert.assertEquals(simpleName.classVarName, "v1beta3_binding"); + + codegen.setOpenAPI(openAPI); + final CodegenModel compoundName = codegen.fromModel("v1beta3.ComponentStatus", openAPI.getComponents().getSchemas().get("v1beta3.ComponentStatus")); + Assert.assertEquals(compoundName.name, "v1beta3.ComponentStatus"); + Assert.assertEquals(compoundName.classname, "V1beta3ComponentStatus"); + Assert.assertEquals(compoundName.classVarName, "v1beta3_component_status"); + + final String path = "/api/v1beta3/namespaces/{namespaces}/bindings"; + final Operation operation = openAPI.getPaths().get(path).getPost(); + final CodegenOperation codegenOperation = codegen.fromOperation(path, "get", operation, null); + Assert.assertEquals(codegenOperation.returnType, "V1beta3Binding"); + Assert.assertEquals(codegenOperation.returnBaseType, "V1beta3Binding"); + } + + @Test(description = "convert a simple java model") + public void simpleModelTest() { + final Schema schema = new Schema() + .description("a sample model") + .addProperties("id", new IntegerSchema().format(SchemaTypeUtil.INTEGER64_FORMAT)) + .addProperties("name", new StringSchema()) + .addProperties("createdAt", new DateTimeSchema()) + .addRequiredItem("id") + .addRequiredItem("name"); + final DefaultCodegen codegen = new PythonPydanticV1ClientCodegen(); + OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", schema); + codegen.setOpenAPI(openAPI); + final CodegenModel cm = codegen.fromModel("sample", schema); + + Assert.assertEquals(cm.name, "sample"); + Assert.assertEquals(cm.classname, "Sample"); + Assert.assertEquals(cm.description, "a sample model"); + Assert.assertEquals(cm.vars.size(), 3); + + final CodegenProperty property1 = cm.vars.get(0); + Assert.assertEquals(property1.baseName, "id"); + Assert.assertEquals(property1.dataType, "int"); + Assert.assertEquals(property1.name, "id"); + Assert.assertNull(property1.defaultValue); + Assert.assertEquals(property1.baseType, "int"); + Assert.assertTrue(property1.required); + Assert.assertTrue(property1.isPrimitiveType); + + final CodegenProperty property2 = cm.vars.get(1); + Assert.assertEquals(property2.baseName, "name"); + Assert.assertEquals(property2.dataType, "str"); + Assert.assertEquals(property2.name, "name"); + Assert.assertNull(property2.defaultValue); + Assert.assertEquals(property2.baseType, "str"); + Assert.assertTrue(property2.required); + Assert.assertTrue(property2.isPrimitiveType); + + final CodegenProperty property3 = cm.vars.get(2); + Assert.assertEquals(property3.baseName, "createdAt"); + Assert.assertEquals(property3.dataType, "datetime"); + Assert.assertEquals(property3.name, "created_at"); + Assert.assertNull(property3.defaultValue); + Assert.assertEquals(property3.baseType, "datetime"); + Assert.assertFalse(property3.required); + } + + @Test(description = "convert a model with list property") + public void listPropertyTest() { + final Schema model = new Schema() + .description("a sample model") + .addProperties("id", new IntegerSchema().format(SchemaTypeUtil.INTEGER64_FORMAT)) + .addProperties("urls", new ArraySchema() + .items(new StringSchema())) + .addRequiredItem("id"); + final DefaultCodegen codegen = new PythonPydanticV1ClientCodegen(); + OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", model); + codegen.setOpenAPI(openAPI); + final CodegenModel cm = codegen.fromModel("sample", model); + + Assert.assertEquals(cm.name, "sample"); + Assert.assertEquals(cm.classname, "Sample"); + Assert.assertEquals(cm.description, "a sample model"); + Assert.assertEquals(cm.vars.size(), 2); + + final CodegenProperty property1 = cm.vars.get(0); + Assert.assertEquals(property1.baseName, "id"); + Assert.assertEquals(property1.dataType, "int"); + Assert.assertEquals(property1.name, "id"); + Assert.assertNull(property1.defaultValue); + Assert.assertEquals(property1.baseType, "int"); + Assert.assertTrue(property1.required); + Assert.assertTrue(property1.isPrimitiveType); + + final CodegenProperty property2 = cm.vars.get(1); + Assert.assertEquals(property2.baseName, "urls"); + Assert.assertEquals(property2.dataType, "List[str]"); + Assert.assertEquals(property2.name, "urls"); + Assert.assertNull(property2.defaultValue); + Assert.assertEquals(property2.baseType, "List"); + Assert.assertEquals(property2.containerType, "array"); + Assert.assertFalse(property2.required); + Assert.assertTrue(property2.isPrimitiveType); + Assert.assertTrue(property2.isContainer); + } + + @Test(description = "convert a model with a map property") + public void mapPropertyTest() { + final Schema model = new Schema() + .description("a sample model") + .addProperties("translations", new MapSchema() + .additionalProperties(new StringSchema())) + .addRequiredItem("id"); + final DefaultCodegen codegen = new PythonPydanticV1ClientCodegen(); + OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", model); + codegen.setOpenAPI(openAPI); + final CodegenModel cm = codegen.fromModel("sample", model); + + Assert.assertEquals(cm.name, "sample"); + Assert.assertEquals(cm.classname, "Sample"); + Assert.assertEquals(cm.description, "a sample model"); + Assert.assertEquals(cm.vars.size(), 1); + + final CodegenProperty property1 = cm.vars.get(0); + Assert.assertEquals(property1.baseName, "translations"); + Assert.assertEquals(property1.dataType, "Dict[str, str]"); + Assert.assertEquals(property1.name, "translations"); + Assert.assertEquals(property1.baseType, "Dict"); + Assert.assertEquals(property1.containerType, "map"); + Assert.assertFalse(property1.required); + Assert.assertTrue(property1.isContainer); + Assert.assertTrue(property1.isPrimitiveType); + } + + @Test(description = "convert a model with complex property") + public void complexPropertyTest() { + final Schema model = new Schema() + .description("a sample model") + .addProperties("children", new Schema().$ref("#/definitions/Children")); + final DefaultCodegen codegen = new PythonPydanticV1ClientCodegen(); + OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", model); + codegen.setOpenAPI(openAPI); + final CodegenModel cm = codegen.fromModel("sample", model); + + Assert.assertEquals(cm.name, "sample"); + Assert.assertEquals(cm.classname, "Sample"); + Assert.assertEquals(cm.description, "a sample model"); + Assert.assertEquals(cm.vars.size(), 1); + + final CodegenProperty property1 = cm.vars.get(0); + Assert.assertEquals(property1.baseName, "children"); + Assert.assertEquals(property1.dataType, "Children"); + Assert.assertEquals(property1.name, "children"); + Assert.assertEquals(property1.baseType, "Children"); + Assert.assertFalse(property1.required); + Assert.assertFalse(property1.isContainer); + } + + @Test(description = "convert a model with complex list property") + public void complexListPropertyTest() { + final Schema model = new Schema() + .description("a sample model") + .addProperties("children", new ArraySchema() + .items(new Schema().$ref("#/definitions/Children"))); + final DefaultCodegen codegen = new PythonPydanticV1ClientCodegen(); + OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", model); + codegen.setOpenAPI(openAPI); + final CodegenModel cm = codegen.fromModel("sample", model); + + Assert.assertEquals(cm.name, "sample"); + Assert.assertEquals(cm.classname, "Sample"); + Assert.assertEquals(cm.description, "a sample model"); + Assert.assertEquals(cm.vars.size(), 1); + + final CodegenProperty property1 = cm.vars.get(0); + Assert.assertEquals(property1.baseName, "children"); + Assert.assertEquals(property1.complexType, "Children"); + Assert.assertEquals(property1.dataType, "List[Children]"); + Assert.assertEquals(property1.name, "children"); + Assert.assertEquals(property1.baseType, "List"); + Assert.assertEquals(property1.containerType, "array"); + Assert.assertFalse(property1.required); + Assert.assertTrue(property1.isContainer); + } + + @Test(description = "convert a model with complex map property") + public void complexMapPropertyTest() { + final Schema model = new Schema() + .description("a sample model") + .addProperties("children", new MapSchema() + .additionalProperties(new Schema().$ref("#/definitions/Children"))); + final DefaultCodegen codegen = new PythonPydanticV1ClientCodegen(); + OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", model); + codegen.setOpenAPI(openAPI); + final CodegenModel cm = codegen.fromModel("sample", model); + + Assert.assertEquals(cm.name, "sample"); + Assert.assertEquals(cm.classname, "Sample"); + Assert.assertEquals(cm.description, "a sample model"); + Assert.assertEquals(cm.vars.size(), 1); + Assert.assertEquals(Sets.intersection(cm.imports, Sets.newHashSet("Children")).size(), 1); + + final CodegenProperty property1 = cm.vars.get(0); + Assert.assertEquals(property1.baseName, "children"); + Assert.assertEquals(property1.complexType, "Children"); + Assert.assertEquals(property1.dataType, "Dict[str, Children]"); + Assert.assertEquals(property1.name, "children"); + Assert.assertEquals(property1.baseType, "Dict"); + Assert.assertEquals(property1.containerType, "map"); + Assert.assertFalse(property1.required); + Assert.assertTrue(property1.isContainer); + } + + + // should not start with 'null'. need help from the community to investigate further + @Test(description = "convert an array model") + public void arrayModelTest() { + final Schema model = new ArraySchema() + //.description() + .items(new Schema().$ref("#/definitions/Children")) + .description("an array model"); + final DefaultCodegen codegen = new PythonPydanticV1ClientCodegen(); + OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", model); + codegen.setOpenAPI(openAPI); + final CodegenModel cm = codegen.fromModel("sample", model); + + Assert.assertEquals(cm.name, "sample"); + Assert.assertEquals(cm.classname, "Sample"); + Assert.assertEquals(cm.description, "an array model"); + Assert.assertEquals(cm.vars.size(), 0); + Assert.assertEquals(cm.parent, "null"); + Assert.assertEquals(cm.imports.size(), 1); + Assert.assertEquals(Sets.intersection(cm.imports, Sets.newHashSet("Children")).size(), 1); + } + + // should not start with 'null'. need help from the community to investigate further + @Test(description = "convert a map model") + public void mapModelTest() { + final Schema model = new Schema() + .description("a map model") + .additionalProperties(new Schema().$ref("#/definitions/Children")); + final DefaultCodegen codegen = new PythonPydanticV1ClientCodegen(); + OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", model); + codegen.setOpenAPI(openAPI); + final CodegenModel cm = codegen.fromModel("sample", model); + + Assert.assertEquals(cm.name, "sample"); + Assert.assertEquals(cm.classname, "Sample"); + Assert.assertEquals(cm.description, "a map model"); + Assert.assertEquals(cm.vars.size(), 0); + Assert.assertEquals(cm.parent, null); + Assert.assertEquals(cm.imports.size(), 0); + } + @Test(description ="check API example has input param(configuration) when it creates api_client") + public void apiExampleDocTest() throws Exception { + final DefaultCodegen codegen = new PythonPydanticV1ClientCodegen(); + final String outputPath = generateFiles(codegen, "src/test/resources/3_0/generic.yaml"); + final Path p = Paths.get(outputPath + "docs/DefaultApi.md"); + + assertFileExists(p); + assertFileContains(p, "openapi_client.ApiClient(configuration) as api_client"); + } + + // Helper function, intended to reduce boilerplate + static private String generateFiles(DefaultCodegen codegen, String filePath) throws IOException { + final File output = Files.createTempDirectory("test").toFile().getCanonicalFile(); + output.deleteOnExit(); + final String outputPath = output.getAbsolutePath().replace('\\', '/'); + + codegen.setOutputDir(output.getAbsolutePath()); + codegen.additionalProperties().put(CXFServerFeatures.LOAD_TEST_DATA_FROM_FILE, "true"); + + final ClientOptInput input = new ClientOptInput(); + final OpenAPI openAPI = new OpenAPIParser().readLocation(filePath, null, new ParseOptions()).getOpenAPI(); + input.openAPI(openAPI); + input.config(codegen); + + final DefaultGenerator generator = new DefaultGenerator(); + final List files = generator.opts(input).generate(); + + Assert.assertTrue(files.size() > 0); + return outputPath + "/"; + } + + @Test(description = "test containerType in parameters") + public void testContainerType() { + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/petstore.yaml"); + final PythonPydanticV1ClientCodegen codegen = new PythonPydanticV1ClientCodegen(); + codegen.setOpenAPI(openAPI); + // path parameter + String path = "/store/order/{orderId}"; + Operation p = openAPI.getPaths().get(path).getGet(); + CodegenOperation op = codegen.fromOperation(path, "get", p, null); + Assert.assertEquals(op.allParams.get(0).containerType, null); + Assert.assertEquals(op.allParams.get(0).baseName, "orderId"); + + // query parameter + path = "/user/login"; + p = openAPI.getPaths().get(path).getGet(); + op = codegen.fromOperation(path, "get", p, null); + Assert.assertEquals(op.allParams.get(0).containerType, null); + Assert.assertEquals(op.allParams.get(0).baseName, "username"); + Assert.assertEquals(op.allParams.get(1).containerType, null); + Assert.assertEquals(op.allParams.get(1).baseName, "password"); + + // body parameter + path = "/user/createWithList"; + p = openAPI.getPaths().get(path).getPost(); + op = codegen.fromOperation(path, "post", p, null); + Assert.assertEquals(op.allParams.get(0).baseName, "User"); + Assert.assertEquals(op.allParams.get(0).containerType, "array"); + Assert.assertEquals(op.allParams.get(0).containerTypeMapped, "List"); + + path = "/pet"; + p = openAPI.getPaths().get(path).getPost(); + op = codegen.fromOperation(path, "post", p, null); + Assert.assertEquals(op.allParams.get(0).baseName, "Pet"); + Assert.assertEquals(op.allParams.get(0).containerType, null); + Assert.assertEquals(op.allParams.get(0).containerTypeMapped, null); + + } + + @Test(description = "test containerType (dict) in parameters") + public void testContainerTypeForDict() { + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/dict_query_parameter.yaml"); + final PythonPydanticV1ClientCodegen codegen = new PythonPydanticV1ClientCodegen(); + codegen.setOpenAPI(openAPI); + // query parameter + String path = "/query_parameter_dict"; + Operation p = openAPI.getPaths().get(path).getGet(); + CodegenOperation op = codegen.fromOperation(path, "get", p, null); + Assert.assertEquals(op.allParams.get(0).containerType, "map"); + Assert.assertEquals(op.allParams.get(0).containerTypeMapped, "Dict"); + Assert.assertEquals(op.allParams.get(0).baseName, "dict_string_integer"); + } + + @Test(description = "convert a model with dollar signs") + public void modelTestDollarSign() { + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/dollar-in-names-pull14359.yaml"); + final DefaultCodegen codegen = new PythonPydanticV1ClientCodegen(); + + codegen.setOpenAPI(openAPI); + final CodegenModel simpleName = codegen.fromModel("$DollarModel$", openAPI.getComponents().getSchemas().get("$DollarModel$")); + Assert.assertEquals(simpleName.name, "$DollarModel$"); + Assert.assertEquals(simpleName.classname, "DollarModel"); + Assert.assertEquals(simpleName.classVarName, "dollar_model"); + + List vars = simpleName.getVars(); + Assert.assertEquals(vars.size(), 1); + CodegenProperty property = vars.get(0); + Assert.assertEquals(property.name, "dollar_value"); + } +} From f87354f8c60449a20055a09fea9a10220e97d375 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Mon, 25 Sep 2023 13:06:13 +0800 Subject: [PATCH 2/7] remove library support in python pydantic v1 codegen --- bin/configs/python-pydantic-v1-aiohttp.yaml | 8 - .../PythonPydanticV1ClientCodegen.java | 19 +- .../python-pydantic-v1/asyncio/rest.mustache | 241 -- .../python-pydantic-v1/tornado/rest.mustache | 223 -- .../echo_api/python-pydantic-v1/README.md | 2 +- .../.github/workflows/python.yml | 38 - .../python-pydantic-v1-aiohttp/.gitignore | 66 - .../python-pydantic-v1-aiohttp/.gitlab-ci.yml | 31 - .../.openapi-generator-ignore | 23 - .../.openapi-generator/FILES | 195 -- .../.openapi-generator/VERSION | 1 - .../python-pydantic-v1-aiohttp/.travis.yml | 17 - .../python-pydantic-v1-aiohttp/README.md | 268 -- .../docs/AdditionalPropertiesAnyType.md | 28 - .../docs/AdditionalPropertiesClass.md | 29 - .../docs/AdditionalPropertiesObject.md | 28 - ...AdditionalPropertiesWithDescriptionOnly.md | 28 - .../docs/AllOfWithSingleRef.md | 29 - .../python-pydantic-v1-aiohttp/docs/Animal.md | 29 - .../docs/AnotherFakeApi.md | 76 - .../docs/AnyOfColor.md | 28 - .../docs/AnyOfPig.md | 30 - .../docs/ApiResponse.md | 30 - .../docs/ArrayOfArrayOfModel.md | 28 - .../docs/ArrayOfArrayOfNumberOnly.md | 28 - .../docs/ArrayOfNumberOnly.md | 28 - .../docs/ArrayTest.md | 30 - .../docs/BasquePig.md | 29 - .../docs/Capitalization.md | 33 - .../python-pydantic-v1-aiohttp/docs/Cat.md | 28 - .../docs/Category.md | 29 - .../docs/CircularReferenceModel.md | 29 - .../docs/ClassModel.md | 29 - .../python-pydantic-v1-aiohttp/docs/Client.md | 28 - .../python-pydantic-v1-aiohttp/docs/Color.md | 28 - .../docs/Creature.md | 29 - .../docs/CreatureInfo.md | 28 - .../docs/DanishPig.md | 29 - .../docs/DefaultApi.md | 69 - .../docs/DeprecatedObject.md | 28 - .../python-pydantic-v1-aiohttp/docs/Dog.md | 28 - .../docs/DummyModel.md | 29 - .../docs/EnumArrays.md | 29 - .../docs/EnumClass.md | 10 - .../docs/EnumString1.md | 10 - .../docs/EnumString2.md | 10 - .../docs/EnumTest.md | 36 - .../docs/FakeApi.md | 1579 --------- .../docs/FakeClassnameTags123Api.md | 87 - .../python-pydantic-v1-aiohttp/docs/File.md | 29 - .../docs/FileSchemaTestClass.md | 29 - .../docs/FirstRef.md | 29 - .../python-pydantic-v1-aiohttp/docs/Foo.md | 28 - .../docs/FooGetDefaultResponse.md | 28 - .../docs/FormatTest.md | 44 - .../docs/HasOnlyReadOnly.md | 29 - .../docs/HealthCheckResult.md | 29 - .../docs/InnerDictWithProperty.md | 28 - .../docs/IntOrString.md | 27 - .../python-pydantic-v1-aiohttp/docs/List.md | 28 - .../docs/MapOfArrayOfModel.md | 28 - .../docs/MapTest.md | 31 - ...dPropertiesAndAdditionalPropertiesClass.md | 30 - .../docs/Model200Response.md | 30 - .../docs/ModelReturn.md | 29 - .../python-pydantic-v1-aiohttp/docs/Name.md | 32 - .../docs/NullableClass.md | 40 - .../docs/NullableProperty.md | 29 - .../docs/NumberOnly.md | 28 - .../docs/ObjectToTestAdditionalProperties.md | 29 - .../docs/ObjectWithDeprecatedFields.md | 31 - .../docs/OneOfEnumString.md | 28 - .../python-pydantic-v1-aiohttp/docs/Order.md | 33 - .../docs/OuterComposite.md | 30 - .../docs/OuterEnum.md | 10 - .../docs/OuterEnumDefaultValue.md | 10 - .../docs/OuterEnumInteger.md | 10 - .../docs/OuterEnumIntegerDefaultValue.md | 10 - .../docs/OuterObjectWithEnumProperty.md | 29 - .../python-pydantic-v1-aiohttp/docs/Parent.md | 28 - .../docs/ParentWithOptionalDict.md | 28 - .../python-pydantic-v1-aiohttp/docs/Pet.md | 33 - .../python-pydantic-v1-aiohttp/docs/PetApi.md | 953 ------ .../python-pydantic-v1-aiohttp/docs/Pig.md | 30 - .../docs/PropertyNameCollision.md | 30 - .../docs/ReadOnlyFirst.md | 29 - .../docs/SecondRef.md | 29 - .../docs/SelfReferenceModel.md | 29 - .../docs/SingleRefType.md | 10 - .../docs/SpecialCharacterEnum.md | 10 - .../docs/SpecialModelName.md | 28 - .../docs/SpecialName.md | 30 - .../docs/StoreApi.md | 287 -- .../python-pydantic-v1-aiohttp/docs/Tag.md | 29 - ...lineFreeformAdditionalPropertiesRequest.md | 28 - .../python-pydantic-v1-aiohttp/docs/Tiger.md | 28 - .../python-pydantic-v1-aiohttp/docs/User.md | 35 - .../docs/UserApi.md | 542 --- .../docs/WithNestedOneOf.md | 30 - .../python-pydantic-v1-aiohttp/git_push.sh | 57 - .../petstore_api/__init__.py | 119 - .../petstore_api/api/__init__.py | 11 - .../petstore_api/api/another_fake_api.py | 176 - .../petstore_api/api/default_api.py | 155 - .../petstore_api/api/fake_api.py | 3028 ----------------- .../api/fake_classname_tags123_api.py | 176 - .../petstore_api/api/pet_api.py | 1239 ------- .../petstore_api/api/store_api.py | 539 --- .../petstore_api/api/user_api.py | 1055 ------ .../petstore_api/api_client.py | 737 ---- .../petstore_api/api_response.py | 25 - .../petstore_api/configuration.py | 601 ---- .../petstore_api/exceptions.py | 166 - .../petstore_api/models/__init__.py | 95 - .../models/additional_properties_any_type.py | 83 - .../models/additional_properties_class.py | 73 - .../models/additional_properties_object.py | 83 - ...tional_properties_with_description_only.py | 83 - .../models/all_of_with_single_ref.py | 74 - .../petstore_api/models/animal.py | 92 - .../petstore_api/models/any_of_color.py | 155 - .../petstore_api/models/any_of_pig.py | 134 - .../petstore_api/models/api_response.py | 75 - .../models/array_of_array_of_model.py | 84 - .../models/array_of_array_of_number_only.py | 71 - .../models/array_of_number_only.py | 71 - .../petstore_api/models/array_test.py | 88 - .../petstore_api/models/basque_pig.py | 73 - .../petstore_api/models/capitalization.py | 81 - .../petstore_api/models/cat.py | 74 - .../petstore_api/models/category.py | 73 - .../models/circular_reference_model.py | 78 - .../petstore_api/models/class_model.py | 71 - .../petstore_api/models/client.py | 71 - .../petstore_api/models/color.py | 170 - .../petstore_api/models/creature.py | 77 - .../petstore_api/models/creature_info.py | 71 - .../petstore_api/models/danish_pig.py | 73 - .../petstore_api/models/deprecated_object.py | 71 - .../petstore_api/models/dog.py | 74 - .../petstore_api/models/dummy_model.py | 78 - .../petstore_api/models/enum_arrays.py | 94 - .../petstore_api/models/enum_class.py | 41 - .../petstore_api/models/enum_string1.py | 40 - .../petstore_api/models/enum_string2.py | 40 - .../petstore_api/models/enum_test.py | 143 - .../petstore_api/models/file.py | 71 - .../models/file_schema_test_class.py | 84 - .../petstore_api/models/first_ref.py | 78 - .../petstore_api/models/foo.py | 71 - .../models/foo_get_default_response.py | 75 - .../petstore_api/models/format_test.py | 143 - .../petstore_api/models/has_only_read_only.py | 75 - .../models/health_check_result.py | 76 - .../models/inner_dict_with_property.py | 71 - .../petstore_api/models/int_or_string.py | 147 - .../petstore_api/models/list.py | 71 - .../models/map_of_array_of_model.py | 88 - .../petstore_api/models/map_test.py | 87 - ...perties_and_additional_properties_class.py | 88 - .../petstore_api/models/model200_response.py | 73 - .../petstore_api/models/model_return.py | 71 - .../petstore_api/models/name.py | 79 - .../petstore_api/models/nullable_class.py | 162 - .../petstore_api/models/nullable_property.py | 88 - .../petstore_api/models/number_only.py | 71 - .../object_to_test_additional_properties.py | 71 - .../models/object_with_deprecated_fields.py | 81 - .../petstore_api/models/one_of_enum_string.py | 141 - .../petstore_api/models/order.py | 91 - .../petstore_api/models/outer_composite.py | 75 - .../petstore_api/models/outer_enum.py | 41 - .../models/outer_enum_default_value.py | 41 - .../petstore_api/models/outer_enum_integer.py | 41 - .../outer_enum_integer_default_value.py | 42 - .../models/outer_object_with_enum_property.py | 80 - .../petstore_api/models/parent.py | 84 - .../models/parent_with_optional_dict.py | 84 - .../petstore_api/models/pet.py | 103 - .../petstore_api/models/pig.py | 144 - .../models/property_name_collision.py | 75 - .../petstore_api/models/read_only_first.py | 74 - .../petstore_api/models/second_ref.py | 78 - .../models/self_reference_model.py | 78 - .../petstore_api/models/single_ref_type.py | 40 - .../models/special_character_enum.py | 48 - .../petstore_api/models/special_model_name.py | 71 - .../petstore_api/models/special_name.py | 89 - .../petstore_api/models/tag.py | 73 - ..._freeform_additional_properties_request.py | 83 - .../petstore_api/models/tiger.py | 71 - .../petstore_api/models/user.py | 85 - .../petstore_api/models/with_nested_one_of.py | 83 - .../petstore_api/py.typed | 0 .../petstore_api/rest.py | 251 -- .../petstore_api/signing.py | 413 --- .../python-pydantic-v1-aiohttp/pyproject.toml | 33 - .../requirements.txt | 7 - .../python-pydantic-v1-aiohttp/setup.cfg | 2 - .../python-pydantic-v1-aiohttp/setup.py | 53 - .../test-requirements.txt | 3 - .../test/__init__.py | 0 .../test_additional_properties_any_type.py | 52 - .../test/test_additional_properties_class.py | 59 - .../test/test_additional_properties_object.py | 52 - ...tional_properties_with_description_only.py | 52 - .../test/test_all_of_with_single_ref.py | 53 - .../test/test_animal.py | 54 - .../test/test_another_fake_api.py | 38 - .../test/test_any_of_color.py | 51 - .../test/test_any_of_pig.py | 57 - .../test/test_api_response.py | 54 - .../test/test_array_of_array_of_model.py | 58 - .../test_array_of_array_of_number_only.py | 56 - .../test/test_array_of_number_only.py | 54 - .../test/test_array_test.py | 66 - .../test/test_basque_pig.py | 55 - .../test/test_capitalization.py | 57 - .../test/test_cat.py | 52 - .../test/test_category.py | 54 - .../test/test_circular_reference_model.py | 60 - .../test/test_class_model.py | 52 - .../test/test_client.py | 52 - .../test/test_color.py | 51 - .../test/test_creature.py | 57 - .../test/test_creature_info.py | 53 - .../test/test_danish_pig.py | 55 - .../test/test_default_api.py | 37 - .../test/test_deprecated_object.py | 52 - .../test/test_dog.py | 52 - .../test/test_dummy_model.py | 56 - .../test/test_enum_arrays.py | 55 - .../test/test_enum_class.py | 34 - .../test/test_enum_string1.py | 34 - .../test/test_enum_string2.py | 34 - .../test/test_enum_test.py | 61 - .../test/test_fake_api.py | 175 - .../test/test_fake_classname_tags123_api.py | 38 - .../test/test_file.py | 52 - .../test/test_file_schema_test_class.py | 57 - .../test/test_first_ref.py | 58 - .../test/test_foo.py | 52 - .../test/test_foo_get_default_response.py | 53 - .../test/test_format_test.py | 71 - .../test/test_has_only_read_only.py | 53 - .../test/test_health_check_result.py | 52 - .../test/test_inner_dict_with_property.py | 52 - .../test/test_int_or_string.py | 51 - .../test/test_list.py | 52 - .../test/test_map_of_array_of_model.py | 58 - .../test/test_map_test.py | 65 - ...perties_and_additional_properties_class.py | 58 - .../test/test_model200_response.py | 53 - .../test/test_model_return.py | 52 - .../test/test_name.py | 56 - .../test/test_nullable_class.py | 77 - .../test/test_nullable_property.py | 55 - .../test/test_number_only.py | 52 - ...st_object_to_test_additional_properties.py | 52 - .../test_object_with_deprecated_fields.py | 58 - .../test/test_one_of_enum_string.py | 51 - .../test/test_order.py | 57 - .../test/test_outer_composite.py | 54 - .../test/test_outer_enum.py | 34 - .../test/test_outer_enum_default_value.py | 34 - .../test/test_outer_enum_integer.py | 34 - .../test_outer_enum_integer_default_value.py | 34 - .../test_outer_object_with_enum_property.py | 54 - .../test/test_parent.py | 55 - .../test/test_parent_with_optional_dict.py | 55 - .../test/test_pet.py | 69 - .../test/test_pet_api.py | 94 - .../test/test_pig.py | 57 - .../test/test_property_name_collision.py | 54 - .../test/test_read_only_first.py | 53 - .../test/test_second_ref.py | 58 - .../test/test_self_reference_model.py | 58 - .../test/test_single_ref_type.py | 34 - .../test/test_special_character_enum.py | 34 - .../test/test_special_model_name.py | 52 - .../test/test_special_name.py | 56 - .../test/test_store_api.py | 59 - .../test/test_tag.py | 53 - ..._freeform_additional_properties_request.py | 52 - .../test/test_tiger.py | 52 - .../test/test_user.py | 59 - .../test/test_user_api.py | 87 - .../test/test_with_nested_one_of.py | 54 - .../python-pydantic-v1-aiohttp/tox.ini | 9 - .../petstore/python-pydantic-v1/README.md | 2 +- 290 files changed, 3 insertions(+), 27048 deletions(-) delete mode 100644 bin/configs/python-pydantic-v1-aiohttp.yaml delete mode 100644 modules/openapi-generator/src/main/resources/python-pydantic-v1/asyncio/rest.mustache delete mode 100644 modules/openapi-generator/src/main/resources/python-pydantic-v1/tornado/rest.mustache delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.github/workflows/python.yml delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.gitignore delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.gitlab-ci.yml delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.openapi-generator-ignore delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.openapi-generator/FILES delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.openapi-generator/VERSION delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.travis.yml delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/README.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AdditionalPropertiesAnyType.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AdditionalPropertiesClass.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AdditionalPropertiesObject.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AdditionalPropertiesWithDescriptionOnly.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AllOfWithSingleRef.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Animal.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AnotherFakeApi.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AnyOfColor.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AnyOfPig.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ApiResponse.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ArrayOfArrayOfModel.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ArrayOfArrayOfNumberOnly.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ArrayOfNumberOnly.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ArrayTest.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/BasquePig.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Capitalization.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Cat.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Category.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/CircularReferenceModel.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ClassModel.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Client.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Color.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Creature.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/CreatureInfo.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/DanishPig.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/DefaultApi.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/DeprecatedObject.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Dog.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/DummyModel.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/EnumArrays.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/EnumClass.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/EnumString1.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/EnumString2.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/EnumTest.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FakeApi.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FakeClassnameTags123Api.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/File.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FileSchemaTestClass.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FirstRef.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Foo.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FooGetDefaultResponse.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FormatTest.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/HasOnlyReadOnly.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/HealthCheckResult.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/InnerDictWithProperty.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/IntOrString.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/List.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/MapOfArrayOfModel.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/MapTest.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/MixedPropertiesAndAdditionalPropertiesClass.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Model200Response.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ModelReturn.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Name.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/NullableClass.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/NullableProperty.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/NumberOnly.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ObjectToTestAdditionalProperties.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ObjectWithDeprecatedFields.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OneOfEnumString.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Order.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OuterComposite.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OuterEnum.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OuterEnumDefaultValue.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OuterEnumInteger.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OuterEnumIntegerDefaultValue.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OuterObjectWithEnumProperty.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Parent.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ParentWithOptionalDict.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Pet.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/PetApi.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Pig.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/PropertyNameCollision.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ReadOnlyFirst.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/SecondRef.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/SelfReferenceModel.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/SingleRefType.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/SpecialCharacterEnum.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/SpecialModelName.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/SpecialName.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/StoreApi.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Tag.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/TestInlineFreeformAdditionalPropertiesRequest.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Tiger.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/User.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/UserApi.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/WithNestedOneOf.md delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/git_push.sh delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/__init__.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/__init__.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/another_fake_api.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/default_api.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/fake_api.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/fake_classname_tags123_api.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/pet_api.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/store_api.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/user_api.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api_client.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api_response.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/configuration.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/exceptions.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/__init__.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/additional_properties_any_type.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/additional_properties_class.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/additional_properties_object.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/additional_properties_with_description_only.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/all_of_with_single_ref.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/animal.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/any_of_color.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/any_of_pig.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/api_response.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/array_of_array_of_model.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/array_of_array_of_number_only.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/array_of_number_only.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/array_test.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/basque_pig.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/capitalization.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/cat.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/category.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/circular_reference_model.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/class_model.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/client.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/color.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/creature.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/creature_info.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/danish_pig.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/deprecated_object.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/dog.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/dummy_model.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/enum_arrays.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/enum_class.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/enum_string1.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/enum_string2.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/enum_test.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/file.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/file_schema_test_class.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/first_ref.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/foo.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/foo_get_default_response.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/format_test.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/has_only_read_only.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/health_check_result.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/inner_dict_with_property.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/int_or_string.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/list.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/map_of_array_of_model.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/map_test.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/mixed_properties_and_additional_properties_class.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/model200_response.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/model_return.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/name.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/nullable_class.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/nullable_property.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/number_only.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/object_to_test_additional_properties.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/object_with_deprecated_fields.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/one_of_enum_string.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/order.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/outer_composite.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/outer_enum.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/outer_enum_default_value.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/outer_enum_integer.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/outer_enum_integer_default_value.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/outer_object_with_enum_property.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/parent.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/parent_with_optional_dict.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/pet.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/pig.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/property_name_collision.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/read_only_first.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/second_ref.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/self_reference_model.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/single_ref_type.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/special_character_enum.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/special_model_name.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/special_name.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/tag.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/test_inline_freeform_additional_properties_request.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/tiger.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/user.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/with_nested_one_of.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/py.typed delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/rest.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/signing.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/pyproject.toml delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/requirements.txt delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/setup.cfg delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/setup.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test-requirements.txt delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/__init__.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_additional_properties_any_type.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_additional_properties_class.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_additional_properties_object.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_additional_properties_with_description_only.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_all_of_with_single_ref.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_animal.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_another_fake_api.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_any_of_color.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_any_of_pig.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_api_response.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_array_of_array_of_model.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_array_of_array_of_number_only.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_array_of_number_only.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_array_test.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_basque_pig.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_capitalization.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_cat.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_category.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_circular_reference_model.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_class_model.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_client.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_color.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_creature.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_creature_info.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_danish_pig.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_default_api.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_deprecated_object.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_dog.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_dummy_model.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_enum_arrays.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_enum_class.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_enum_string1.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_enum_string2.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_enum_test.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_fake_api.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_fake_classname_tags123_api.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_file.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_file_schema_test_class.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_first_ref.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_foo.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_foo_get_default_response.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_format_test.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_has_only_read_only.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_health_check_result.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_inner_dict_with_property.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_int_or_string.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_list.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_map_of_array_of_model.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_map_test.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_mixed_properties_and_additional_properties_class.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_model200_response.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_model_return.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_name.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_nullable_class.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_nullable_property.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_number_only.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_object_to_test_additional_properties.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_object_with_deprecated_fields.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_one_of_enum_string.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_order.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_outer_composite.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_outer_enum.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_outer_enum_default_value.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_outer_enum_integer.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_outer_enum_integer_default_value.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_outer_object_with_enum_property.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_parent.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_parent_with_optional_dict.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_pet.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_pet_api.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_pig.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_property_name_collision.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_read_only_first.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_second_ref.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_self_reference_model.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_single_ref_type.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_special_character_enum.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_special_model_name.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_special_name.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_store_api.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_tag.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_test_inline_freeform_additional_properties_request.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_tiger.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_user.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_user_api.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_with_nested_one_of.py delete mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/tox.ini diff --git a/bin/configs/python-pydantic-v1-aiohttp.yaml b/bin/configs/python-pydantic-v1-aiohttp.yaml deleted file mode 100644 index 2ba8f2326741..000000000000 --- a/bin/configs/python-pydantic-v1-aiohttp.yaml +++ /dev/null @@ -1,8 +0,0 @@ -generatorName: python-pydantic-v1 -outputDir: samples/openapi3/client/petstore/python-pydantic-v1-aiohttp -inputSpec: modules/openapi-generator/src/test/resources/3_0/python/petstore-with-fake-endpoints-models-for-testing.yaml -templateDir: modules/openapi-generator/src/main/resources/python-pydantic-v1 -library: asyncio -additionalProperties: - packageName: petstore_api - mapNumberTo: float diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonPydanticV1ClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonPydanticV1ClientCodegen.java index 08db2c380ac3..708a0f6280d3 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonPydanticV1ClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonPydanticV1ClientCodegen.java @@ -165,14 +165,6 @@ public PythonPydanticV1ClientCodegen() { .defaultValue("%Y-%m-%d")); cliOptions.add(new CliOption(CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP, CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP_DESC).defaultValue("false")); - supportedLibraries.put("urllib3", "urllib3-based client"); - supportedLibraries.put("asyncio", "asyncio-based client"); - supportedLibraries.put("tornado", "tornado-based client (deprecated)"); - CliOption libraryOption = new CliOption(CodegenConstants.LIBRARY, "library template (sub-template) to use: asyncio, tornado (deprecated), urllib3"); - libraryOption.setDefault(DEFAULT_LIBRARY); - cliOptions.add(libraryOption); - setLibrary(DEFAULT_LIBRARY); - // option to change how we process + set the data in the 'additionalProperties' keyword. CliOption disallowAdditionalPropertiesIfNotPresentOpt = CliOption.newBoolean( CodegenConstants.DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT, @@ -335,16 +327,7 @@ public void processOpts() { supportingFiles.add(new SupportingFile("api_client.mustache", packagePath(), "api_client.py")); supportingFiles.add(new SupportingFile("api_response.mustache", packagePath(), "api_response.py")); - - if ("asyncio".equals(getLibrary())) { - supportingFiles.add(new SupportingFile("asyncio/rest.mustache", packagePath(), "rest.py")); - additionalProperties.put("asyncio", "true"); - } else if ("tornado".equals(getLibrary())) { - supportingFiles.add(new SupportingFile("tornado/rest.mustache", packagePath(), "rest.py")); - additionalProperties.put("tornado", "true"); - } else { - supportingFiles.add(new SupportingFile("rest.mustache", packagePath(), "rest.py")); - } + supportingFiles.add(new SupportingFile("rest.mustache", packagePath(), "rest.py")); modelPackage = this.packageName + "." + modelPackage; apiPackage = this.packageName + "." + apiPackage; diff --git a/modules/openapi-generator/src/main/resources/python-pydantic-v1/asyncio/rest.mustache b/modules/openapi-generator/src/main/resources/python-pydantic-v1/asyncio/rest.mustache deleted file mode 100644 index c97788d0c5cc..000000000000 --- a/modules/openapi-generator/src/main/resources/python-pydantic-v1/asyncio/rest.mustache +++ /dev/null @@ -1,241 +0,0 @@ -# coding: utf-8 - -{{>partial_header}} - -import io -import json -import logging -import re -import ssl - -import aiohttp -from urllib.parse import urlencode, quote_plus - -from {{packageName}}.exceptions import ApiException, ApiValueError - -logger = logging.getLogger(__name__) - - -class RESTResponse(io.IOBase): - - def __init__(self, resp, data) -> None: - self.aiohttp_response = resp - self.status = resp.status - self.reason = resp.reason - self.data = data - - def getheaders(self): - """Returns a CIMultiDictProxy of the response headers.""" - return self.aiohttp_response.headers - - def getheader(self, name, default=None): - """Returns a given response header.""" - return self.aiohttp_response.headers.get(name, default) - - -class RESTClientObject: - - def __init__(self, configuration, pools_size=4, maxsize=None) -> None: - - # maxsize is number of requests to host that are allowed in parallel - if maxsize is None: - maxsize = configuration.connection_pool_maxsize - - ssl_context = ssl.create_default_context(cafile=configuration.ssl_ca_cert) - if configuration.cert_file: - ssl_context.load_cert_chain( - configuration.cert_file, keyfile=configuration.key_file - ) - - if not configuration.verify_ssl: - ssl_context.check_hostname = False - ssl_context.verify_mode = ssl.CERT_NONE - - connector = aiohttp.TCPConnector( - limit=maxsize, - ssl=ssl_context - ) - - self.proxy = configuration.proxy - self.proxy_headers = configuration.proxy_headers - - # https pool manager - self.pool_manager = aiohttp.ClientSession( - connector=connector, - trust_env=True - ) - - async def close(self): - await self.pool_manager.close() - - async def request(self, method, url, query_params=None, headers=None, - body=None, post_params=None, _preload_content=True, - _request_timeout=None): - """Execute request - - :param method: http request method - :param url: http request url - :param query_params: query parameters in the url - :param headers: http request headers - :param body: request json body, for `application/json` - :param post_params: request post parameters, - `application/x-www-form-urlencoded` - and `multipart/form-data` - :param _preload_content: this is a non-applicable field for - the AiohttpClient. - :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. - """ - method = method.upper() - assert method in ['GET', 'HEAD', 'DELETE', 'POST', 'PUT', - 'PATCH', 'OPTIONS'] - - if post_params and body: - raise ApiValueError( - "body parameter cannot be used with post_params parameter." - ) - - post_params = post_params or {} - headers = headers or {} - # url already contains the URL query string - # so reset query_params to empty dict - query_params = {} - timeout = _request_timeout or 5 * 60 - - if 'Content-Type' not in headers: - headers['Content-Type'] = 'application/json' - - args = { - "method": method, - "url": url, - "timeout": timeout, - "headers": headers - } - - if self.proxy: - args["proxy"] = self.proxy - if self.proxy_headers: - args["proxy_headers"] = self.proxy_headers - - if query_params: - args["url"] += '?' + urlencode(query_params) - - # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` - if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']: - if re.search('json', headers['Content-Type'], re.IGNORECASE): - if body is not None: - body = json.dumps(body) - args["data"] = body - elif headers['Content-Type'] == 'application/x-www-form-urlencoded': # noqa: E501 - args["data"] = aiohttp.FormData(post_params) - elif headers['Content-Type'] == 'multipart/form-data': - # must del headers['Content-Type'], or the correct - # Content-Type which generated by aiohttp - del headers['Content-Type'] - data = aiohttp.FormData() - for param in post_params: - k, v = param - if isinstance(v, tuple) and len(v) == 3: - data.add_field(k, - value=v[1], - filename=v[0], - content_type=v[2]) - else: - data.add_field(k, v) - args["data"] = data - - # Pass a `bytes` parameter directly in the body to support - # other content types than Json when `body` argument is provided - # in serialized form - elif isinstance(body, bytes): - args["data"] = body - else: - # Cannot generate the request from given parameters - msg = """Cannot prepare a request message for provided - arguments. Please check that your arguments match - declared content type.""" - raise ApiException(status=0, reason=msg) - - r = await self.pool_manager.request(**args) - if _preload_content: - - data = await r.read() - r = RESTResponse(r, data) - - # log response body - logger.debug("response body: %s", r.data) - - if not 200 <= r.status <= 299: - raise ApiException(http_resp=r) - - return r - - async def get_request(self, url, headers=None, query_params=None, - _preload_content=True, _request_timeout=None): - return (await self.request("GET", url, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - query_params=query_params)) - - async def head_request(self, url, headers=None, query_params=None, - _preload_content=True, _request_timeout=None): - return (await self.request("HEAD", url, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - query_params=query_params)) - - async def options_request(self, url, headers=None, query_params=None, - post_params=None, body=None, _preload_content=True, - _request_timeout=None): - return (await self.request("OPTIONS", url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body)) - - async def delete_request(self, url, headers=None, query_params=None, body=None, - _preload_content=True, _request_timeout=None): - return (await self.request("DELETE", url, - headers=headers, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body)) - - async def post_request(self, url, headers=None, query_params=None, - post_params=None, body=None, _preload_content=True, - _request_timeout=None): - return (await self.request("POST", url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body)) - - async def put_request(self, url, headers=None, query_params=None, post_params=None, - body=None, _preload_content=True, _request_timeout=None): - return (await self.request("PUT", url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body)) - - async def patch_request(self, url, headers=None, query_params=None, - post_params=None, body=None, _preload_content=True, - _request_timeout=None): - return (await self.request("PATCH", url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body)) diff --git a/modules/openapi-generator/src/main/resources/python-pydantic-v1/tornado/rest.mustache b/modules/openapi-generator/src/main/resources/python-pydantic-v1/tornado/rest.mustache deleted file mode 100644 index 6b91cdef986e..000000000000 --- a/modules/openapi-generator/src/main/resources/python-pydantic-v1/tornado/rest.mustache +++ /dev/null @@ -1,223 +0,0 @@ -# coding: utf-8 - -{{>partial_header}} - -import io -import json -import logging -import re - -from urllib.parse import urlencode, quote_plus -import tornado -import tornado.gen -from tornado import httpclient -from urllib3.filepost import encode_multipart_formdata - -from {{packageName}}.exceptions import ApiException, ApiValueError - -logger = logging.getLogger(__name__) - - -class RESTResponse(io.IOBase): - - def __init__(self, resp) -> None: - self.tornado_response = resp - self.status = resp.code - self.reason = resp.reason - - if resp.body: - self.data = resp.body - else: - self.data = None - - def getheaders(self): - """Returns a CIMultiDictProxy of the response headers.""" - return self.tornado_response.headers - - def getheader(self, name, default=None): - """Returns a given response header.""" - return self.tornado_response.headers.get(name, default) - - -class RESTClientObject: - - def __init__(self, configuration, pools_size=4, maxsize=4) -> None: - # maxsize is number of requests to host that are allowed in parallel - - self.ca_certs = configuration.ssl_ca_cert - self.client_key = configuration.key_file - self.client_cert = configuration.cert_file - - self.proxy_port = self.proxy_host = None - - # https pool manager - if configuration.proxy: - self.proxy_port = 80 - self.proxy_host = configuration.proxy - - self.pool_manager = httpclient.AsyncHTTPClient() - - @tornado.gen.coroutine - def request(self, method, url, query_params=None, headers=None, body=None, - post_params=None, _preload_content=True, - _request_timeout=None): - """Execute Request - - :param method: http request method - :param url: http request url - :param query_params: query parameters in the url - :param headers: http request headers - :param body: request json body, for `application/json` - :param post_params: request post parameters, - `application/x-www-form-urlencoded` - and `multipart/form-data` - :param _preload_content: this is a non-applicable field for - the AiohttpClient. - :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. - """ - method = method.upper() - assert method in ['GET', 'HEAD', 'DELETE', 'POST', 'PUT', - 'PATCH', 'OPTIONS'] - - if post_params and body: - raise ApiValueError( - "body parameter cannot be used with post_params parameter." - ) - - request = httpclient.HTTPRequest(url) - request.allow_nonstandard_methods = True - request.ca_certs = self.ca_certs - request.client_key = self.client_key - request.client_cert = self.client_cert - request.proxy_host = self.proxy_host - request.proxy_port = self.proxy_port - request.method = method - if headers: - request.headers = headers - if 'Content-Type' not in headers: - request.headers['Content-Type'] = 'application/json' - request.request_timeout = _request_timeout or 5 * 60 - - post_params = post_params or {} - - if query_params: - request.url += '?' + urlencode(query_params) - - # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` - if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']: - if re.search('json', headers['Content-Type'], re.IGNORECASE): - if body: - body = json.dumps(body) - request.body = body - elif headers['Content-Type'] == 'application/x-www-form-urlencoded': # noqa: E501 - request.body = urlencode(post_params) - elif headers['Content-Type'] == 'multipart/form-data': - multipart = encode_multipart_formdata(post_params) - request.body, headers['Content-Type'] = multipart - # Pass a `bytes` parameter directly in the body to support - # other content types than Json when `body` argument is provided - # in serialized form - elif isinstance(body, bytes): - request.body = body - else: - # Cannot generate the request from given parameters - msg = """Cannot prepare a request message for provided - arguments. Please check that your arguments match - declared content type.""" - raise ApiException(status=0, reason=msg) - - r = yield self.pool_manager.fetch(request, raise_error=False) - - if _preload_content: - - r = RESTResponse(r) - - # log response body - logger.debug("response body: %s", r.data) - - if not 200 <= r.status <= 299: - raise ApiException(http_resp=r) - - raise tornado.gen.Return(r) - - @tornado.gen.coroutine - def GET(self, url, headers=None, query_params=None, _preload_content=True, - _request_timeout=None): - result = yield self.request("GET", url, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - query_params=query_params) - raise tornado.gen.Return(result) - - @tornado.gen.coroutine - def HEAD(self, url, headers=None, query_params=None, _preload_content=True, - _request_timeout=None): - result = yield self.request("HEAD", url, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - query_params=query_params) - raise tornado.gen.Return(result) - - @tornado.gen.coroutine - def OPTIONS(self, url, headers=None, query_params=None, post_params=None, - body=None, _preload_content=True, _request_timeout=None): - result = yield self.request("OPTIONS", url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - raise tornado.gen.Return(result) - - @tornado.gen.coroutine - def DELETE(self, url, headers=None, query_params=None, body=None, - _preload_content=True, _request_timeout=None): - result = yield self.request("DELETE", url, - headers=headers, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - raise tornado.gen.Return(result) - - @tornado.gen.coroutine - def POST(self, url, headers=None, query_params=None, post_params=None, - body=None, _preload_content=True, _request_timeout=None): - result = yield self.request("POST", url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - raise tornado.gen.Return(result) - - @tornado.gen.coroutine - def PUT(self, url, headers=None, query_params=None, post_params=None, - body=None, _preload_content=True, _request_timeout=None): - result = yield self.request("PUT", url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - raise tornado.gen.Return(result) - - @tornado.gen.coroutine - def PATCH(self, url, headers=None, query_params=None, post_params=None, - body=None, _preload_content=True, _request_timeout=None): - result = yield self.request("PATCH", url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - raise tornado.gen.Return(result) diff --git a/samples/client/echo_api/python-pydantic-v1/README.md b/samples/client/echo_api/python-pydantic-v1/README.md index 22ead776a46d..89af693938f6 100644 --- a/samples/client/echo_api/python-pydantic-v1/README.md +++ b/samples/client/echo_api/python-pydantic-v1/README.md @@ -5,7 +5,7 @@ This Python package is automatically generated by the [OpenAPI Generator](https: - API version: 0.1.0 - Package version: 1.0.0 -- Build package: org.openapitools.codegen.languages.PythonClientPydanticV1Codegen +- Build package: org.openapitools.codegen.languages.PythonPydanticV1ClientCodegen ## Requirements. diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.github/workflows/python.yml b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.github/workflows/python.yml deleted file mode 100644 index fed030f265ed..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.github/workflows/python.yml +++ /dev/null @@ -1,38 +0,0 @@ -# NOTE: This file is auto generated by OpenAPI Generator. -# URL: https://openapi-generator.tech -# -# ref: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python - -name: petstore_api Python package - -on: [push, pull_request] - -jobs: - build: - - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] - - steps: - - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install flake8 pytest - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - if [ -f test-requirements.txt ]; then pip install -r test-requirements.txt; fi - - name: Lint with flake8 - run: | - # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - name: Test with pytest - run: | - pytest diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.gitignore b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.gitignore deleted file mode 100644 index 43995bd42fa2..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.gitignore +++ /dev/null @@ -1,66 +0,0 @@ -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class - -# C extensions -*.so - -# Distribution / packaging -.Python -env/ -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -*.egg-info/ -.installed.cfg -*.egg - -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*,cover -.hypothesis/ -venv/ -.venv/ -.python-version -.pytest_cache - -# Translations -*.mo -*.pot - -# Django stuff: -*.log - -# Sphinx documentation -docs/_build/ - -# PyBuilder -target/ - -#Ipython Notebook -.ipynb_checkpoints diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.gitlab-ci.yml b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.gitlab-ci.yml deleted file mode 100644 index b4719756536b..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.gitlab-ci.yml +++ /dev/null @@ -1,31 +0,0 @@ -# NOTE: This file is auto generated by OpenAPI Generator. -# URL: https://openapi-generator.tech -# -# ref: https://docs.gitlab.com/ee/ci/README.html -# ref: https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Python.gitlab-ci.yml - -stages: - - test - -.pytest: - stage: test - script: - - pip install -r requirements.txt - - pip install -r test-requirements.txt - - pytest --cov=petstore_api - -pytest-3.7: - extends: .pytest - image: python:3.7-alpine -pytest-3.8: - extends: .pytest - image: python:3.8-alpine -pytest-3.9: - extends: .pytest - image: python:3.9-alpine -pytest-3.10: - extends: .pytest - image: python:3.10-alpine -pytest-3.11: - extends: .pytest - image: python:3.11-alpine diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.openapi-generator-ignore b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.openapi-generator-ignore deleted file mode 100644 index 7484ee590a38..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.openapi-generator-ignore +++ /dev/null @@ -1,23 +0,0 @@ -# OpenAPI Generator Ignore -# Generated by openapi-generator https://github.com/openapitools/openapi-generator - -# Use this file to prevent files from being overwritten by the generator. -# The patterns follow closely to .gitignore or .dockerignore. - -# As an example, the C# client generator defines ApiClient.cs. -# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: -#ApiClient.cs - -# You can match any string of characters against a directory, file or extension with a single asterisk (*): -#foo/*/qux -# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux - -# You can recursively match patterns against a directory, file or extension with a double asterisk (**): -#foo/**/qux -# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux - -# You can also negate patterns with an exclamation (!). -# For example, you can ignore all files in a docs folder with the file extension .md: -#docs/*.md -# Then explicitly reverse the ignore rule for a single file: -#!docs/README.md diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.openapi-generator/FILES b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.openapi-generator/FILES deleted file mode 100644 index e943667b1f60..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.openapi-generator/FILES +++ /dev/null @@ -1,195 +0,0 @@ -.github/workflows/python.yml -.gitignore -.gitlab-ci.yml -.travis.yml -README.md -docs/AdditionalPropertiesAnyType.md -docs/AdditionalPropertiesClass.md -docs/AdditionalPropertiesObject.md -docs/AdditionalPropertiesWithDescriptionOnly.md -docs/AllOfWithSingleRef.md -docs/Animal.md -docs/AnotherFakeApi.md -docs/AnyOfColor.md -docs/AnyOfPig.md -docs/ApiResponse.md -docs/ArrayOfArrayOfModel.md -docs/ArrayOfArrayOfNumberOnly.md -docs/ArrayOfNumberOnly.md -docs/ArrayTest.md -docs/BasquePig.md -docs/Capitalization.md -docs/Cat.md -docs/Category.md -docs/CircularReferenceModel.md -docs/ClassModel.md -docs/Client.md -docs/Color.md -docs/Creature.md -docs/CreatureInfo.md -docs/DanishPig.md -docs/DefaultApi.md -docs/DeprecatedObject.md -docs/Dog.md -docs/DummyModel.md -docs/EnumArrays.md -docs/EnumClass.md -docs/EnumString1.md -docs/EnumString2.md -docs/EnumTest.md -docs/FakeApi.md -docs/FakeClassnameTags123Api.md -docs/File.md -docs/FileSchemaTestClass.md -docs/FirstRef.md -docs/Foo.md -docs/FooGetDefaultResponse.md -docs/FormatTest.md -docs/HasOnlyReadOnly.md -docs/HealthCheckResult.md -docs/InnerDictWithProperty.md -docs/IntOrString.md -docs/List.md -docs/MapOfArrayOfModel.md -docs/MapTest.md -docs/MixedPropertiesAndAdditionalPropertiesClass.md -docs/Model200Response.md -docs/ModelReturn.md -docs/Name.md -docs/NullableClass.md -docs/NullableProperty.md -docs/NumberOnly.md -docs/ObjectToTestAdditionalProperties.md -docs/ObjectWithDeprecatedFields.md -docs/OneOfEnumString.md -docs/Order.md -docs/OuterComposite.md -docs/OuterEnum.md -docs/OuterEnumDefaultValue.md -docs/OuterEnumInteger.md -docs/OuterEnumIntegerDefaultValue.md -docs/OuterObjectWithEnumProperty.md -docs/Parent.md -docs/ParentWithOptionalDict.md -docs/Pet.md -docs/PetApi.md -docs/Pig.md -docs/PropertyNameCollision.md -docs/ReadOnlyFirst.md -docs/SecondRef.md -docs/SelfReferenceModel.md -docs/SingleRefType.md -docs/SpecialCharacterEnum.md -docs/SpecialModelName.md -docs/SpecialName.md -docs/StoreApi.md -docs/Tag.md -docs/TestInlineFreeformAdditionalPropertiesRequest.md -docs/Tiger.md -docs/User.md -docs/UserApi.md -docs/WithNestedOneOf.md -git_push.sh -petstore_api/__init__.py -petstore_api/api/__init__.py -petstore_api/api/another_fake_api.py -petstore_api/api/default_api.py -petstore_api/api/fake_api.py -petstore_api/api/fake_classname_tags123_api.py -petstore_api/api/pet_api.py -petstore_api/api/store_api.py -petstore_api/api/user_api.py -petstore_api/api_client.py -petstore_api/api_response.py -petstore_api/configuration.py -petstore_api/exceptions.py -petstore_api/models/__init__.py -petstore_api/models/additional_properties_any_type.py -petstore_api/models/additional_properties_class.py -petstore_api/models/additional_properties_object.py -petstore_api/models/additional_properties_with_description_only.py -petstore_api/models/all_of_with_single_ref.py -petstore_api/models/animal.py -petstore_api/models/any_of_color.py -petstore_api/models/any_of_pig.py -petstore_api/models/api_response.py -petstore_api/models/array_of_array_of_model.py -petstore_api/models/array_of_array_of_number_only.py -petstore_api/models/array_of_number_only.py -petstore_api/models/array_test.py -petstore_api/models/basque_pig.py -petstore_api/models/capitalization.py -petstore_api/models/cat.py -petstore_api/models/category.py -petstore_api/models/circular_reference_model.py -petstore_api/models/class_model.py -petstore_api/models/client.py -petstore_api/models/color.py -petstore_api/models/creature.py -petstore_api/models/creature_info.py -petstore_api/models/danish_pig.py -petstore_api/models/deprecated_object.py -petstore_api/models/dog.py -petstore_api/models/dummy_model.py -petstore_api/models/enum_arrays.py -petstore_api/models/enum_class.py -petstore_api/models/enum_string1.py -petstore_api/models/enum_string2.py -petstore_api/models/enum_test.py -petstore_api/models/file.py -petstore_api/models/file_schema_test_class.py -petstore_api/models/first_ref.py -petstore_api/models/foo.py -petstore_api/models/foo_get_default_response.py -petstore_api/models/format_test.py -petstore_api/models/has_only_read_only.py -petstore_api/models/health_check_result.py -petstore_api/models/inner_dict_with_property.py -petstore_api/models/int_or_string.py -petstore_api/models/list.py -petstore_api/models/map_of_array_of_model.py -petstore_api/models/map_test.py -petstore_api/models/mixed_properties_and_additional_properties_class.py -petstore_api/models/model200_response.py -petstore_api/models/model_return.py -petstore_api/models/name.py -petstore_api/models/nullable_class.py -petstore_api/models/nullable_property.py -petstore_api/models/number_only.py -petstore_api/models/object_to_test_additional_properties.py -petstore_api/models/object_with_deprecated_fields.py -petstore_api/models/one_of_enum_string.py -petstore_api/models/order.py -petstore_api/models/outer_composite.py -petstore_api/models/outer_enum.py -petstore_api/models/outer_enum_default_value.py -petstore_api/models/outer_enum_integer.py -petstore_api/models/outer_enum_integer_default_value.py -petstore_api/models/outer_object_with_enum_property.py -petstore_api/models/parent.py -petstore_api/models/parent_with_optional_dict.py -petstore_api/models/pet.py -petstore_api/models/pig.py -petstore_api/models/property_name_collision.py -petstore_api/models/read_only_first.py -petstore_api/models/second_ref.py -petstore_api/models/self_reference_model.py -petstore_api/models/single_ref_type.py -petstore_api/models/special_character_enum.py -petstore_api/models/special_model_name.py -petstore_api/models/special_name.py -petstore_api/models/tag.py -petstore_api/models/test_inline_freeform_additional_properties_request.py -petstore_api/models/tiger.py -petstore_api/models/user.py -petstore_api/models/with_nested_one_of.py -petstore_api/py.typed -petstore_api/rest.py -petstore_api/signing.py -pyproject.toml -requirements.txt -setup.cfg -setup.py -test-requirements.txt -test/__init__.py -tox.ini diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.openapi-generator/VERSION b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.openapi-generator/VERSION deleted file mode 100644 index 40e36364ab27..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.openapi-generator/VERSION +++ /dev/null @@ -1 +0,0 @@ -7.1.0-SNAPSHOT \ No newline at end of file diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.travis.yml b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.travis.yml deleted file mode 100644 index bb28138c5b1a..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.travis.yml +++ /dev/null @@ -1,17 +0,0 @@ -# ref: https://docs.travis-ci.com/user/languages/python -language: python -python: - - "3.7" - - "3.8" - - "3.9" - - "3.10" - - "3.11" - # uncomment the following if needed - #- "3.11-dev" # 3.11 development branch - #- "nightly" # nightly build -# command to install dependencies -install: - - "pip install -r requirements.txt" - - "pip install -r test-requirements.txt" -# command to run tests -script: pytest --cov=petstore_api diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/README.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/README.md deleted file mode 100644 index 19e8359feb80..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/README.md +++ /dev/null @@ -1,268 +0,0 @@ -# petstore-api -This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - -This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: - -- API version: 1.0.0 -- Package version: 1.0.0 -- Build package: org.openapitools.codegen.languages.PythonClientPydanticV1Codegen - -## Requirements. - -Python 3.7+ - -## Installation & Usage -### pip install - -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 -``` -(you may need to run `pip` with root permission: `sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git`) - -Then import the package: -```python -import petstore_api -``` - -### Setuptools - -Install via [Setuptools](http://pypi.python.org/pypi/setuptools). - -```sh -python setup.py install --user -``` -(or `sudo python setup.py install` to install the package for all users) - -Then import the package: -```python -import petstore_api -``` - -### Tests - -Execute `pytest` to run the tests. - -## Getting Started - -Please follow the [installation procedure](#installation--usage) and then run the following: - -```python -import datetime -import time -import petstore_api -from petstore_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - - - -# Enter a context with an instance of the API client -async with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.AnotherFakeApi(api_client) - client = petstore_api.Client() # Client | client model - - try: - # To test special tags - api_response = await api_instance.call_123_test_special_tags(client) - print("The response of AnotherFakeApi->call_123_test_special_tags:\n") - pprint(api_response) - except ApiException as e: - print("Exception when calling AnotherFakeApi->call_123_test_special_tags: %s\n" % e) - -``` - -## Documentation for API Endpoints - -All URIs are relative to *http://petstore.swagger.io:80/v2* - -Class | Method | HTTP request | Description ------------- | ------------- | ------------- | ------------- -*AnotherFakeApi* | [**call_123_test_special_tags**](docs/AnotherFakeApi.md#call_123_test_special_tags) | **PATCH** /another-fake/dummy | To test special tags -*DefaultApi* | [**foo_get**](docs/DefaultApi.md#foo_get) | **GET** /foo | -*FakeApi* | [**fake_any_type_request_body**](docs/FakeApi.md#fake_any_type_request_body) | **POST** /fake/any_type_body | test any type request body -*FakeApi* | [**fake_enum_ref_query_parameter**](docs/FakeApi.md#fake_enum_ref_query_parameter) | **GET** /fake/enum_ref_query_parameter | test enum reference query parameter -*FakeApi* | [**fake_health_get**](docs/FakeApi.md#fake_health_get) | **GET** /fake/health | Health check endpoint -*FakeApi* | [**fake_http_signature_test**](docs/FakeApi.md#fake_http_signature_test) | **GET** /fake/http-signature-test | test http signature authentication -*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_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* | [**fake_property_enum_integer_serialize**](docs/FakeApi.md#fake_property_enum_integer_serialize) | **POST** /fake/property/enum-int | -*FakeApi* | [**fake_return_list_of_objects**](docs/FakeApi.md#fake_return_list_of_objects) | **GET** /fake/return_list_of_object | test returning list of objects -*FakeApi* | [**fake_uuid_example**](docs/FakeApi.md#fake_uuid_example) | **GET** /fake/uuid_example | test uuid example -*FakeApi* | [**test_body_with_binary**](docs/FakeApi.md#test_body_with_binary) | **PUT** /fake/body-with-binary | -*FakeApi* | [**test_body_with_file_schema**](docs/FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema | -*FakeApi* | [**test_body_with_query_params**](docs/FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params | -*FakeApi* | [**test_client_model**](docs/FakeApi.md#test_client_model) | **PATCH** /fake | To test \"client\" model -*FakeApi* | [**test_date_time_query_parameter**](docs/FakeApi.md#test_date_time_query_parameter) | **PUT** /fake/date-time-query-params | -*FakeApi* | [**test_endpoint_parameters**](docs/FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 -*FakeApi* | [**test_group_parameters**](docs/FakeApi.md#test_group_parameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) -*FakeApi* | [**test_inline_additional_properties**](docs/FakeApi.md#test_inline_additional_properties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties -*FakeApi* | [**test_inline_freeform_additional_properties**](docs/FakeApi.md#test_inline_freeform_additional_properties) | **POST** /fake/inline-freeform-additionalProperties | test inline free-form additionalProperties -*FakeApi* | [**test_json_form_data**](docs/FakeApi.md#test_json_form_data) | **GET** /fake/jsonFormData | test json serialization of form data -*FakeApi* | [**test_query_parameter_collection_format**](docs/FakeApi.md#test_query_parameter_collection_format) | **PUT** /fake/test-query-parameters | -*FakeClassnameTags123Api* | [**test_classname**](docs/FakeClassnameTags123Api.md#test_classname) | **PATCH** /fake_classname_test | To test class name in snake case -*PetApi* | [**add_pet**](docs/PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store -*PetApi* | [**delete_pet**](docs/PetApi.md#delete_pet) | **DELETE** /pet/{petId} | Deletes a pet -*PetApi* | [**find_pets_by_status**](docs/PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status -*PetApi* | [**find_pets_by_tags**](docs/PetApi.md#find_pets_by_tags) | **GET** /pet/findByTags | Finds Pets by tags -*PetApi* | [**get_pet_by_id**](docs/PetApi.md#get_pet_by_id) | **GET** /pet/{petId} | Find pet by ID -*PetApi* | [**update_pet**](docs/PetApi.md#update_pet) | **PUT** /pet | Update an existing pet -*PetApi* | [**update_pet_with_form**](docs/PetApi.md#update_pet_with_form) | **POST** /pet/{petId} | Updates a pet in the store with form data -*PetApi* | [**upload_file**](docs/PetApi.md#upload_file) | **POST** /pet/{petId}/uploadImage | uploads an image -*PetApi* | [**upload_file_with_required_file**](docs/PetApi.md#upload_file_with_required_file) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) -*StoreApi* | [**delete_order**](docs/StoreApi.md#delete_order) | **DELETE** /store/order/{order_id} | Delete purchase order by ID -*StoreApi* | [**get_inventory**](docs/StoreApi.md#get_inventory) | **GET** /store/inventory | Returns pet inventories by status -*StoreApi* | [**get_order_by_id**](docs/StoreApi.md#get_order_by_id) | **GET** /store/order/{order_id} | Find purchase order by ID -*StoreApi* | [**place_order**](docs/StoreApi.md#place_order) | **POST** /store/order | Place an order for a pet -*UserApi* | [**create_user**](docs/UserApi.md#create_user) | **POST** /user | Create user -*UserApi* | [**create_users_with_array_input**](docs/UserApi.md#create_users_with_array_input) | **POST** /user/createWithArray | Creates list of users with given input array -*UserApi* | [**create_users_with_list_input**](docs/UserApi.md#create_users_with_list_input) | **POST** /user/createWithList | Creates list of users with given input array -*UserApi* | [**delete_user**](docs/UserApi.md#delete_user) | **DELETE** /user/{username} | Delete user -*UserApi* | [**get_user_by_name**](docs/UserApi.md#get_user_by_name) | **GET** /user/{username} | Get user by user name -*UserApi* | [**login_user**](docs/UserApi.md#login_user) | **GET** /user/login | Logs user into the system -*UserApi* | [**logout_user**](docs/UserApi.md#logout_user) | **GET** /user/logout | Logs out current logged in user session -*UserApi* | [**update_user**](docs/UserApi.md#update_user) | **PUT** /user/{username} | Updated user - - -## Documentation For Models - - - [AdditionalPropertiesAnyType](docs/AdditionalPropertiesAnyType.md) - - [AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md) - - [AdditionalPropertiesObject](docs/AdditionalPropertiesObject.md) - - [AdditionalPropertiesWithDescriptionOnly](docs/AdditionalPropertiesWithDescriptionOnly.md) - - [AllOfWithSingleRef](docs/AllOfWithSingleRef.md) - - [Animal](docs/Animal.md) - - [AnyOfColor](docs/AnyOfColor.md) - - [AnyOfPig](docs/AnyOfPig.md) - - [ApiResponse](docs/ApiResponse.md) - - [ArrayOfArrayOfModel](docs/ArrayOfArrayOfModel.md) - - [ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md) - - [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md) - - [ArrayTest](docs/ArrayTest.md) - - [BasquePig](docs/BasquePig.md) - - [Capitalization](docs/Capitalization.md) - - [Cat](docs/Cat.md) - - [Category](docs/Category.md) - - [CircularReferenceModel](docs/CircularReferenceModel.md) - - [ClassModel](docs/ClassModel.md) - - [Client](docs/Client.md) - - [Color](docs/Color.md) - - [Creature](docs/Creature.md) - - [CreatureInfo](docs/CreatureInfo.md) - - [DanishPig](docs/DanishPig.md) - - [DeprecatedObject](docs/DeprecatedObject.md) - - [Dog](docs/Dog.md) - - [DummyModel](docs/DummyModel.md) - - [EnumArrays](docs/EnumArrays.md) - - [EnumClass](docs/EnumClass.md) - - [EnumString1](docs/EnumString1.md) - - [EnumString2](docs/EnumString2.md) - - [EnumTest](docs/EnumTest.md) - - [File](docs/File.md) - - [FileSchemaTestClass](docs/FileSchemaTestClass.md) - - [FirstRef](docs/FirstRef.md) - - [Foo](docs/Foo.md) - - [FooGetDefaultResponse](docs/FooGetDefaultResponse.md) - - [FormatTest](docs/FormatTest.md) - - [HasOnlyReadOnly](docs/HasOnlyReadOnly.md) - - [HealthCheckResult](docs/HealthCheckResult.md) - - [InnerDictWithProperty](docs/InnerDictWithProperty.md) - - [IntOrString](docs/IntOrString.md) - - [List](docs/List.md) - - [MapOfArrayOfModel](docs/MapOfArrayOfModel.md) - - [MapTest](docs/MapTest.md) - - [MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md) - - [Model200Response](docs/Model200Response.md) - - [ModelReturn](docs/ModelReturn.md) - - [Name](docs/Name.md) - - [NullableClass](docs/NullableClass.md) - - [NullableProperty](docs/NullableProperty.md) - - [NumberOnly](docs/NumberOnly.md) - - [ObjectToTestAdditionalProperties](docs/ObjectToTestAdditionalProperties.md) - - [ObjectWithDeprecatedFields](docs/ObjectWithDeprecatedFields.md) - - [OneOfEnumString](docs/OneOfEnumString.md) - - [Order](docs/Order.md) - - [OuterComposite](docs/OuterComposite.md) - - [OuterEnum](docs/OuterEnum.md) - - [OuterEnumDefaultValue](docs/OuterEnumDefaultValue.md) - - [OuterEnumInteger](docs/OuterEnumInteger.md) - - [OuterEnumIntegerDefaultValue](docs/OuterEnumIntegerDefaultValue.md) - - [OuterObjectWithEnumProperty](docs/OuterObjectWithEnumProperty.md) - - [Parent](docs/Parent.md) - - [ParentWithOptionalDict](docs/ParentWithOptionalDict.md) - - [Pet](docs/Pet.md) - - [Pig](docs/Pig.md) - - [PropertyNameCollision](docs/PropertyNameCollision.md) - - [ReadOnlyFirst](docs/ReadOnlyFirst.md) - - [SecondRef](docs/SecondRef.md) - - [SelfReferenceModel](docs/SelfReferenceModel.md) - - [SingleRefType](docs/SingleRefType.md) - - [SpecialCharacterEnum](docs/SpecialCharacterEnum.md) - - [SpecialModelName](docs/SpecialModelName.md) - - [SpecialName](docs/SpecialName.md) - - [Tag](docs/Tag.md) - - [TestInlineFreeformAdditionalPropertiesRequest](docs/TestInlineFreeformAdditionalPropertiesRequest.md) - - [Tiger](docs/Tiger.md) - - [User](docs/User.md) - - [WithNestedOneOf](docs/WithNestedOneOf.md) - - - -## Documentation For Authorization - - -Authentication schemes defined for the API: - -### petstore_auth - -- **Type**: OAuth -- **Flow**: implicit -- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog -- **Scopes**: - - **write:pets**: modify pets in your account - - **read:pets**: read your pets - - -### api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - - -### api_key_query - -- **Type**: API key -- **API key parameter name**: api_key_query -- **Location**: URL query string - - -### http_basic_test - -- **Type**: HTTP basic authentication - - -### bearer_test - -- **Type**: Bearer authentication (JWT) - - -### http_signature_test - -- **Type**: HTTP signature authentication - - -## Author - - - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AdditionalPropertiesAnyType.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AdditionalPropertiesAnyType.md deleted file mode 100644 index beedef76c051..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AdditionalPropertiesAnyType.md +++ /dev/null @@ -1,28 +0,0 @@ -# AdditionalPropertiesAnyType - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**name** | **str** | | [optional] - -## Example - -```python -from petstore_api.models.additional_properties_any_type import AdditionalPropertiesAnyType - -# TODO update the JSON string below -json = "{}" -# create an instance of AdditionalPropertiesAnyType from a JSON string -additional_properties_any_type_instance = AdditionalPropertiesAnyType.from_json(json) -# print the JSON string representation of the object -print AdditionalPropertiesAnyType.to_json() - -# convert the object into a dict -additional_properties_any_type_dict = additional_properties_any_type_instance.to_dict() -# create an instance of AdditionalPropertiesAnyType from a dict -additional_properties_any_type_form_dict = additional_properties_any_type.from_dict(additional_properties_any_type_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AdditionalPropertiesClass.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AdditionalPropertiesClass.md deleted file mode 100644 index 6abc3136b9ca..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AdditionalPropertiesClass.md +++ /dev/null @@ -1,29 +0,0 @@ -# AdditionalPropertiesClass - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**map_property** | **Dict[str, str]** | | [optional] -**map_of_map_property** | **Dict[str, Dict[str, str]]** | | [optional] - -## Example - -```python -from petstore_api.models.additional_properties_class import AdditionalPropertiesClass - -# TODO update the JSON string below -json = "{}" -# create an instance of AdditionalPropertiesClass from a JSON string -additional_properties_class_instance = AdditionalPropertiesClass.from_json(json) -# print the JSON string representation of the object -print AdditionalPropertiesClass.to_json() - -# convert the object into a dict -additional_properties_class_dict = additional_properties_class_instance.to_dict() -# create an instance of AdditionalPropertiesClass from a dict -additional_properties_class_form_dict = additional_properties_class.from_dict(additional_properties_class_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AdditionalPropertiesObject.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AdditionalPropertiesObject.md deleted file mode 100644 index 8b9259c687f6..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AdditionalPropertiesObject.md +++ /dev/null @@ -1,28 +0,0 @@ -# AdditionalPropertiesObject - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**name** | **str** | | [optional] - -## Example - -```python -from petstore_api.models.additional_properties_object import AdditionalPropertiesObject - -# TODO update the JSON string below -json = "{}" -# create an instance of AdditionalPropertiesObject from a JSON string -additional_properties_object_instance = AdditionalPropertiesObject.from_json(json) -# print the JSON string representation of the object -print AdditionalPropertiesObject.to_json() - -# convert the object into a dict -additional_properties_object_dict = additional_properties_object_instance.to_dict() -# create an instance of AdditionalPropertiesObject from a dict -additional_properties_object_form_dict = additional_properties_object.from_dict(additional_properties_object_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AdditionalPropertiesWithDescriptionOnly.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AdditionalPropertiesWithDescriptionOnly.md deleted file mode 100644 index d66094f18e57..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AdditionalPropertiesWithDescriptionOnly.md +++ /dev/null @@ -1,28 +0,0 @@ -# AdditionalPropertiesWithDescriptionOnly - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**name** | **str** | | [optional] - -## Example - -```python -from petstore_api.models.additional_properties_with_description_only import AdditionalPropertiesWithDescriptionOnly - -# TODO update the JSON string below -json = "{}" -# create an instance of AdditionalPropertiesWithDescriptionOnly from a JSON string -additional_properties_with_description_only_instance = AdditionalPropertiesWithDescriptionOnly.from_json(json) -# print the JSON string representation of the object -print AdditionalPropertiesWithDescriptionOnly.to_json() - -# convert the object into a dict -additional_properties_with_description_only_dict = additional_properties_with_description_only_instance.to_dict() -# create an instance of AdditionalPropertiesWithDescriptionOnly from a dict -additional_properties_with_description_only_form_dict = additional_properties_with_description_only.from_dict(additional_properties_with_description_only_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AllOfWithSingleRef.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AllOfWithSingleRef.md deleted file mode 100644 index 1a8b4df7ecc5..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AllOfWithSingleRef.md +++ /dev/null @@ -1,29 +0,0 @@ -# AllOfWithSingleRef - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**username** | **str** | | [optional] -**single_ref_type** | [**SingleRefType**](SingleRefType.md) | | [optional] - -## Example - -```python -from petstore_api.models.all_of_with_single_ref import AllOfWithSingleRef - -# TODO update the JSON string below -json = "{}" -# create an instance of AllOfWithSingleRef from a JSON string -all_of_with_single_ref_instance = AllOfWithSingleRef.from_json(json) -# print the JSON string representation of the object -print AllOfWithSingleRef.to_json() - -# convert the object into a dict -all_of_with_single_ref_dict = all_of_with_single_ref_instance.to_dict() -# create an instance of AllOfWithSingleRef from a dict -all_of_with_single_ref_form_dict = all_of_with_single_ref.from_dict(all_of_with_single_ref_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Animal.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Animal.md deleted file mode 100644 index b62f19690994..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Animal.md +++ /dev/null @@ -1,29 +0,0 @@ -# Animal - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**class_name** | **str** | | -**color** | **str** | | [optional] [default to 'red'] - -## Example - -```python -from petstore_api.models.animal import Animal - -# TODO update the JSON string below -json = "{}" -# create an instance of Animal from a JSON string -animal_instance = Animal.from_json(json) -# print the JSON string representation of the object -print Animal.to_json() - -# convert the object into a dict -animal_dict = animal_instance.to_dict() -# create an instance of Animal from a dict -animal_form_dict = animal.from_dict(animal_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AnotherFakeApi.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AnotherFakeApi.md deleted file mode 100644 index 95447def35e4..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AnotherFakeApi.md +++ /dev/null @@ -1,76 +0,0 @@ -# petstore_api.AnotherFakeApi - -All URIs are relative to *http://petstore.swagger.io:80/v2* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**call_123_test_special_tags**](AnotherFakeApi.md#call_123_test_special_tags) | **PATCH** /another-fake/dummy | To test special tags - - -# **call_123_test_special_tags** -> Client call_123_test_special_tags(client) - -To test special tags - -To test special tags and operation ID starting with number - -### Example - -```python -import time -import os -import petstore_api -from petstore_api.models.client import Client -from petstore_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - - -# Enter a context with an instance of the API client -async with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.AnotherFakeApi(api_client) - client = petstore_api.Client() # Client | client model - - try: - # To test special tags - api_response = await api_instance.call_123_test_special_tags(client) - print("The response of AnotherFakeApi->call_123_test_special_tags:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling AnotherFakeApi->call_123_test_special_tags: %s\n" % e) -``` - - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **client** | [**Client**](Client.md)| client model | - -### Return type - -[**Client**](Client.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | successful operation | - | - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AnyOfColor.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AnyOfColor.md deleted file mode 100644 index 9b161ccba1c0..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AnyOfColor.md +++ /dev/null @@ -1,28 +0,0 @@ -# AnyOfColor - -Any of RGB array, RGBA array, or hex string. - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -## Example - -```python -from petstore_api.models.any_of_color import AnyOfColor - -# TODO update the JSON string below -json = "{}" -# create an instance of AnyOfColor from a JSON string -any_of_color_instance = AnyOfColor.from_json(json) -# print the JSON string representation of the object -print AnyOfColor.to_json() - -# convert the object into a dict -any_of_color_dict = any_of_color_instance.to_dict() -# create an instance of AnyOfColor from a dict -any_of_color_form_dict = any_of_color.from_dict(any_of_color_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AnyOfPig.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AnyOfPig.md deleted file mode 100644 index 2da7ca6eefe7..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AnyOfPig.md +++ /dev/null @@ -1,30 +0,0 @@ -# AnyOfPig - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**class_name** | **str** | | -**color** | **str** | | -**size** | **int** | | - -## Example - -```python -from petstore_api.models.any_of_pig import AnyOfPig - -# TODO update the JSON string below -json = "{}" -# create an instance of AnyOfPig from a JSON string -any_of_pig_instance = AnyOfPig.from_json(json) -# print the JSON string representation of the object -print AnyOfPig.to_json() - -# convert the object into a dict -any_of_pig_dict = any_of_pig_instance.to_dict() -# create an instance of AnyOfPig from a dict -any_of_pig_form_dict = any_of_pig.from_dict(any_of_pig_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ApiResponse.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ApiResponse.md deleted file mode 100644 index ba35ea9e2f0e..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ApiResponse.md +++ /dev/null @@ -1,30 +0,0 @@ -# ApiResponse - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**code** | **int** | | [optional] -**type** | **str** | | [optional] -**message** | **str** | | [optional] - -## Example - -```python -from petstore_api.models.api_response import ApiResponse - -# TODO update the JSON string below -json = "{}" -# create an instance of ApiResponse from a JSON string -api_response_instance = ApiResponse.from_json(json) -# print the JSON string representation of the object -print ApiResponse.to_json() - -# convert the object into a dict -api_response_dict = api_response_instance.to_dict() -# create an instance of ApiResponse from a dict -api_response_form_dict = api_response.from_dict(api_response_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ArrayOfArrayOfModel.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ArrayOfArrayOfModel.md deleted file mode 100644 index 094061592613..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ArrayOfArrayOfModel.md +++ /dev/null @@ -1,28 +0,0 @@ -# ArrayOfArrayOfModel - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**another_property** | **List[List[Tag]]** | | [optional] - -## Example - -```python -from petstore_api.models.array_of_array_of_model import ArrayOfArrayOfModel - -# TODO update the JSON string below -json = "{}" -# create an instance of ArrayOfArrayOfModel from a JSON string -array_of_array_of_model_instance = ArrayOfArrayOfModel.from_json(json) -# print the JSON string representation of the object -print ArrayOfArrayOfModel.to_json() - -# convert the object into a dict -array_of_array_of_model_dict = array_of_array_of_model_instance.to_dict() -# create an instance of ArrayOfArrayOfModel from a dict -array_of_array_of_model_form_dict = array_of_array_of_model.from_dict(array_of_array_of_model_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ArrayOfArrayOfNumberOnly.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ArrayOfArrayOfNumberOnly.md deleted file mode 100644 index 3f0c127d4fa3..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ArrayOfArrayOfNumberOnly.md +++ /dev/null @@ -1,28 +0,0 @@ -# ArrayOfArrayOfNumberOnly - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**array_array_number** | **List[List[float]]** | | [optional] - -## Example - -```python -from petstore_api.models.array_of_array_of_number_only import ArrayOfArrayOfNumberOnly - -# TODO update the JSON string below -json = "{}" -# create an instance of ArrayOfArrayOfNumberOnly from a JSON string -array_of_array_of_number_only_instance = ArrayOfArrayOfNumberOnly.from_json(json) -# print the JSON string representation of the object -print ArrayOfArrayOfNumberOnly.to_json() - -# convert the object into a dict -array_of_array_of_number_only_dict = array_of_array_of_number_only_instance.to_dict() -# create an instance of ArrayOfArrayOfNumberOnly from a dict -array_of_array_of_number_only_form_dict = array_of_array_of_number_only.from_dict(array_of_array_of_number_only_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ArrayOfNumberOnly.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ArrayOfNumberOnly.md deleted file mode 100644 index c10191915a70..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ArrayOfNumberOnly.md +++ /dev/null @@ -1,28 +0,0 @@ -# ArrayOfNumberOnly - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**array_number** | **List[float]** | | [optional] - -## Example - -```python -from petstore_api.models.array_of_number_only import ArrayOfNumberOnly - -# TODO update the JSON string below -json = "{}" -# create an instance of ArrayOfNumberOnly from a JSON string -array_of_number_only_instance = ArrayOfNumberOnly.from_json(json) -# print the JSON string representation of the object -print ArrayOfNumberOnly.to_json() - -# convert the object into a dict -array_of_number_only_dict = array_of_number_only_instance.to_dict() -# create an instance of ArrayOfNumberOnly from a dict -array_of_number_only_form_dict = array_of_number_only.from_dict(array_of_number_only_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ArrayTest.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ArrayTest.md deleted file mode 100644 index 0a40fb36d26f..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ArrayTest.md +++ /dev/null @@ -1,30 +0,0 @@ -# ArrayTest - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**array_of_string** | **List[str]** | | [optional] -**array_array_of_integer** | **List[List[int]]** | | [optional] -**array_array_of_model** | **List[List[ReadOnlyFirst]]** | | [optional] - -## Example - -```python -from petstore_api.models.array_test import ArrayTest - -# TODO update the JSON string below -json = "{}" -# create an instance of ArrayTest from a JSON string -array_test_instance = ArrayTest.from_json(json) -# print the JSON string representation of the object -print ArrayTest.to_json() - -# convert the object into a dict -array_test_dict = array_test_instance.to_dict() -# create an instance of ArrayTest from a dict -array_test_form_dict = array_test.from_dict(array_test_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/BasquePig.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/BasquePig.md deleted file mode 100644 index 552b9390c7e5..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/BasquePig.md +++ /dev/null @@ -1,29 +0,0 @@ -# BasquePig - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**class_name** | **str** | | -**color** | **str** | | - -## Example - -```python -from petstore_api.models.basque_pig import BasquePig - -# TODO update the JSON string below -json = "{}" -# create an instance of BasquePig from a JSON string -basque_pig_instance = BasquePig.from_json(json) -# print the JSON string representation of the object -print BasquePig.to_json() - -# convert the object into a dict -basque_pig_dict = basque_pig_instance.to_dict() -# create an instance of BasquePig from a dict -basque_pig_form_dict = basque_pig.from_dict(basque_pig_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Capitalization.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Capitalization.md deleted file mode 100644 index 99e6fae88fde..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Capitalization.md +++ /dev/null @@ -1,33 +0,0 @@ -# Capitalization - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**small_camel** | **str** | | [optional] -**capital_camel** | **str** | | [optional] -**small_snake** | **str** | | [optional] -**capital_snake** | **str** | | [optional] -**sca_eth_flow_points** | **str** | | [optional] -**att_name** | **str** | Name of the pet | [optional] - -## Example - -```python -from petstore_api.models.capitalization import Capitalization - -# TODO update the JSON string below -json = "{}" -# create an instance of Capitalization from a JSON string -capitalization_instance = Capitalization.from_json(json) -# print the JSON string representation of the object -print Capitalization.to_json() - -# convert the object into a dict -capitalization_dict = capitalization_instance.to_dict() -# create an instance of Capitalization from a dict -capitalization_form_dict = capitalization.from_dict(capitalization_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Cat.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Cat.md deleted file mode 100644 index 4b509dda7ea3..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Cat.md +++ /dev/null @@ -1,28 +0,0 @@ -# Cat - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**declawed** | **bool** | | [optional] - -## Example - -```python -from petstore_api.models.cat import Cat - -# TODO update the JSON string below -json = "{}" -# create an instance of Cat from a JSON string -cat_instance = Cat.from_json(json) -# print the JSON string representation of the object -print Cat.to_json() - -# convert the object into a dict -cat_dict = cat_instance.to_dict() -# create an instance of Cat from a dict -cat_form_dict = cat.from_dict(cat_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Category.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Category.md deleted file mode 100644 index c49514ef8023..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Category.md +++ /dev/null @@ -1,29 +0,0 @@ -# Category - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **int** | | [optional] -**name** | **str** | | [default to 'default-name'] - -## Example - -```python -from petstore_api.models.category import Category - -# TODO update the JSON string below -json = "{}" -# create an instance of Category from a JSON string -category_instance = Category.from_json(json) -# print the JSON string representation of the object -print Category.to_json() - -# convert the object into a dict -category_dict = category_instance.to_dict() -# create an instance of Category from a dict -category_form_dict = category.from_dict(category_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/CircularReferenceModel.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/CircularReferenceModel.md deleted file mode 100644 index d5e97934d2be..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/CircularReferenceModel.md +++ /dev/null @@ -1,29 +0,0 @@ -# CircularReferenceModel - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**size** | **int** | | [optional] -**nested** | [**FirstRef**](FirstRef.md) | | [optional] - -## Example - -```python -from petstore_api.models.circular_reference_model import CircularReferenceModel - -# TODO update the JSON string below -json = "{}" -# create an instance of CircularReferenceModel from a JSON string -circular_reference_model_instance = CircularReferenceModel.from_json(json) -# print the JSON string representation of the object -print CircularReferenceModel.to_json() - -# convert the object into a dict -circular_reference_model_dict = circular_reference_model_instance.to_dict() -# create an instance of CircularReferenceModel from a dict -circular_reference_model_form_dict = circular_reference_model.from_dict(circular_reference_model_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ClassModel.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ClassModel.md deleted file mode 100644 index 1b6fb7cfc77d..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ClassModel.md +++ /dev/null @@ -1,29 +0,0 @@ -# ClassModel - -Model for testing model with \"_class\" property - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**var_class** | **str** | | [optional] - -## Example - -```python -from petstore_api.models.class_model import ClassModel - -# TODO update the JSON string below -json = "{}" -# create an instance of ClassModel from a JSON string -class_model_instance = ClassModel.from_json(json) -# print the JSON string representation of the object -print ClassModel.to_json() - -# convert the object into a dict -class_model_dict = class_model_instance.to_dict() -# create an instance of ClassModel from a dict -class_model_form_dict = class_model.from_dict(class_model_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Client.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Client.md deleted file mode 100644 index b0ded10dd762..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Client.md +++ /dev/null @@ -1,28 +0,0 @@ -# Client - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**client** | **str** | | [optional] - -## Example - -```python -from petstore_api.models.client import Client - -# TODO update the JSON string below -json = "{}" -# create an instance of Client from a JSON string -client_instance = Client.from_json(json) -# print the JSON string representation of the object -print Client.to_json() - -# convert the object into a dict -client_dict = client_instance.to_dict() -# create an instance of Client from a dict -client_form_dict = client.from_dict(client_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Color.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Color.md deleted file mode 100644 index 07fcd01991ac..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Color.md +++ /dev/null @@ -1,28 +0,0 @@ -# Color - -RGB array, RGBA array, or hex string. - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -## Example - -```python -from petstore_api.models.color import Color - -# TODO update the JSON string below -json = "{}" -# create an instance of Color from a JSON string -color_instance = Color.from_json(json) -# print the JSON string representation of the object -print Color.to_json() - -# convert the object into a dict -color_dict = color_instance.to_dict() -# create an instance of Color from a dict -color_form_dict = color.from_dict(color_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Creature.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Creature.md deleted file mode 100644 index 54249d5871e0..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Creature.md +++ /dev/null @@ -1,29 +0,0 @@ -# Creature - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**info** | [**CreatureInfo**](CreatureInfo.md) | | -**type** | **str** | | - -## Example - -```python -from petstore_api.models.creature import Creature - -# TODO update the JSON string below -json = "{}" -# create an instance of Creature from a JSON string -creature_instance = Creature.from_json(json) -# print the JSON string representation of the object -print Creature.to_json() - -# convert the object into a dict -creature_dict = creature_instance.to_dict() -# create an instance of Creature from a dict -creature_form_dict = creature.from_dict(creature_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/CreatureInfo.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/CreatureInfo.md deleted file mode 100644 index 5a600b9f3374..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/CreatureInfo.md +++ /dev/null @@ -1,28 +0,0 @@ -# CreatureInfo - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**name** | **str** | | - -## Example - -```python -from petstore_api.models.creature_info import CreatureInfo - -# TODO update the JSON string below -json = "{}" -# create an instance of CreatureInfo from a JSON string -creature_info_instance = CreatureInfo.from_json(json) -# print the JSON string representation of the object -print CreatureInfo.to_json() - -# convert the object into a dict -creature_info_dict = creature_info_instance.to_dict() -# create an instance of CreatureInfo from a dict -creature_info_form_dict = creature_info.from_dict(creature_info_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/DanishPig.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/DanishPig.md deleted file mode 100644 index 253616c2fc32..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/DanishPig.md +++ /dev/null @@ -1,29 +0,0 @@ -# DanishPig - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**class_name** | **str** | | -**size** | **int** | | - -## Example - -```python -from petstore_api.models.danish_pig import DanishPig - -# TODO update the JSON string below -json = "{}" -# create an instance of DanishPig from a JSON string -danish_pig_instance = DanishPig.from_json(json) -# print the JSON string representation of the object -print DanishPig.to_json() - -# convert the object into a dict -danish_pig_dict = danish_pig_instance.to_dict() -# create an instance of DanishPig from a dict -danish_pig_form_dict = danish_pig.from_dict(danish_pig_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/DefaultApi.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/DefaultApi.md deleted file mode 100644 index 558535484016..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/DefaultApi.md +++ /dev/null @@ -1,69 +0,0 @@ -# petstore_api.DefaultApi - -All URIs are relative to *http://petstore.swagger.io:80/v2* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**foo_get**](DefaultApi.md#foo_get) | **GET** /foo | - - -# **foo_get** -> FooGetDefaultResponse foo_get() - - - -### Example - -```python -import time -import os -import petstore_api -from petstore_api.models.foo_get_default_response import FooGetDefaultResponse -from petstore_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - - -# Enter a context with an instance of the API client -async with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.DefaultApi(api_client) - - try: - api_response = await api_instance.foo_get() - print("The response of DefaultApi->foo_get:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling DefaultApi->foo_get: %s\n" % e) -``` - - - -### Parameters -This endpoint does not need any parameter. - -### Return type - -[**FooGetDefaultResponse**](FooGetDefaultResponse.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**0** | response | - | - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/DeprecatedObject.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/DeprecatedObject.md deleted file mode 100644 index e6cf57189634..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/DeprecatedObject.md +++ /dev/null @@ -1,28 +0,0 @@ -# DeprecatedObject - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**name** | **str** | | [optional] - -## Example - -```python -from petstore_api.models.deprecated_object import DeprecatedObject - -# TODO update the JSON string below -json = "{}" -# create an instance of DeprecatedObject from a JSON string -deprecated_object_instance = DeprecatedObject.from_json(json) -# print the JSON string representation of the object -print DeprecatedObject.to_json() - -# convert the object into a dict -deprecated_object_dict = deprecated_object_instance.to_dict() -# create an instance of DeprecatedObject from a dict -deprecated_object_form_dict = deprecated_object.from_dict(deprecated_object_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Dog.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Dog.md deleted file mode 100644 index 3469be73a761..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Dog.md +++ /dev/null @@ -1,28 +0,0 @@ -# Dog - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**breed** | **str** | | [optional] - -## Example - -```python -from petstore_api.models.dog import Dog - -# TODO update the JSON string below -json = "{}" -# create an instance of Dog from a JSON string -dog_instance = Dog.from_json(json) -# print the JSON string representation of the object -print Dog.to_json() - -# convert the object into a dict -dog_dict = dog_instance.to_dict() -# create an instance of Dog from a dict -dog_form_dict = dog.from_dict(dog_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/DummyModel.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/DummyModel.md deleted file mode 100644 index e690a8874f8c..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/DummyModel.md +++ /dev/null @@ -1,29 +0,0 @@ -# DummyModel - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**category** | **str** | | [optional] -**self_ref** | [**SelfReferenceModel**](SelfReferenceModel.md) | | [optional] - -## Example - -```python -from petstore_api.models.dummy_model import DummyModel - -# TODO update the JSON string below -json = "{}" -# create an instance of DummyModel from a JSON string -dummy_model_instance = DummyModel.from_json(json) -# print the JSON string representation of the object -print DummyModel.to_json() - -# convert the object into a dict -dummy_model_dict = dummy_model_instance.to_dict() -# create an instance of DummyModel from a dict -dummy_model_form_dict = dummy_model.from_dict(dummy_model_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/EnumArrays.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/EnumArrays.md deleted file mode 100644 index d21f58a66087..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/EnumArrays.md +++ /dev/null @@ -1,29 +0,0 @@ -# EnumArrays - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**just_symbol** | **str** | | [optional] -**array_enum** | **List[str]** | | [optional] - -## Example - -```python -from petstore_api.models.enum_arrays import EnumArrays - -# TODO update the JSON string below -json = "{}" -# create an instance of EnumArrays from a JSON string -enum_arrays_instance = EnumArrays.from_json(json) -# print the JSON string representation of the object -print EnumArrays.to_json() - -# convert the object into a dict -enum_arrays_dict = enum_arrays_instance.to_dict() -# create an instance of EnumArrays from a dict -enum_arrays_form_dict = enum_arrays.from_dict(enum_arrays_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/EnumClass.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/EnumClass.md deleted file mode 100644 index 64830e3d1dee..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/EnumClass.md +++ /dev/null @@ -1,10 +0,0 @@ -# EnumClass - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/EnumString1.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/EnumString1.md deleted file mode 100644 index 194d65b48fa0..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/EnumString1.md +++ /dev/null @@ -1,10 +0,0 @@ -# EnumString1 - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/EnumString2.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/EnumString2.md deleted file mode 100644 index 0d8568bfbeff..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/EnumString2.md +++ /dev/null @@ -1,10 +0,0 @@ -# EnumString2 - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/EnumTest.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/EnumTest.md deleted file mode 100644 index 5bcb8e7027e3..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/EnumTest.md +++ /dev/null @@ -1,36 +0,0 @@ -# EnumTest - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**enum_string** | **str** | | [optional] -**enum_string_required** | **str** | | -**enum_integer_default** | **int** | | [optional] [default to 5] -**enum_integer** | **int** | | [optional] -**enum_number** | **float** | | [optional] -**outer_enum** | [**OuterEnum**](OuterEnum.md) | | [optional] -**outer_enum_integer** | [**OuterEnumInteger**](OuterEnumInteger.md) | | [optional] -**outer_enum_default_value** | [**OuterEnumDefaultValue**](OuterEnumDefaultValue.md) | | [optional] -**outer_enum_integer_default_value** | [**OuterEnumIntegerDefaultValue**](OuterEnumIntegerDefaultValue.md) | | [optional] - -## Example - -```python -from petstore_api.models.enum_test import EnumTest - -# TODO update the JSON string below -json = "{}" -# create an instance of EnumTest from a JSON string -enum_test_instance = EnumTest.from_json(json) -# print the JSON string representation of the object -print EnumTest.to_json() - -# convert the object into a dict -enum_test_dict = enum_test_instance.to_dict() -# create an instance of EnumTest from a dict -enum_test_form_dict = enum_test.from_dict(enum_test_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FakeApi.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FakeApi.md deleted file mode 100644 index be5d5e850c79..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FakeApi.md +++ /dev/null @@ -1,1579 +0,0 @@ -# petstore_api.FakeApi - -All URIs are relative to *http://petstore.swagger.io:80/v2* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**fake_any_type_request_body**](FakeApi.md#fake_any_type_request_body) | **POST** /fake/any_type_body | test any type request body -[**fake_enum_ref_query_parameter**](FakeApi.md#fake_enum_ref_query_parameter) | **GET** /fake/enum_ref_query_parameter | test enum reference query parameter -[**fake_health_get**](FakeApi.md#fake_health_get) | **GET** /fake/health | Health check endpoint -[**fake_http_signature_test**](FakeApi.md#fake_http_signature_test) | **GET** /fake/http-signature-test | test http signature authentication -[**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_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 | -[**fake_property_enum_integer_serialize**](FakeApi.md#fake_property_enum_integer_serialize) | **POST** /fake/property/enum-int | -[**fake_return_list_of_objects**](FakeApi.md#fake_return_list_of_objects) | **GET** /fake/return_list_of_object | test returning list of objects -[**fake_uuid_example**](FakeApi.md#fake_uuid_example) | **GET** /fake/uuid_example | test uuid example -[**test_body_with_binary**](FakeApi.md#test_body_with_binary) | **PUT** /fake/body-with-binary | -[**test_body_with_file_schema**](FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema | -[**test_body_with_query_params**](FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params | -[**test_client_model**](FakeApi.md#test_client_model) | **PATCH** /fake | To test \"client\" model -[**test_date_time_query_parameter**](FakeApi.md#test_date_time_query_parameter) | **PUT** /fake/date-time-query-params | -[**test_endpoint_parameters**](FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 -[**test_group_parameters**](FakeApi.md#test_group_parameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) -[**test_inline_additional_properties**](FakeApi.md#test_inline_additional_properties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties -[**test_inline_freeform_additional_properties**](FakeApi.md#test_inline_freeform_additional_properties) | **POST** /fake/inline-freeform-additionalProperties | test inline free-form additionalProperties -[**test_json_form_data**](FakeApi.md#test_json_form_data) | **GET** /fake/jsonFormData | test json serialization of form data -[**test_query_parameter_collection_format**](FakeApi.md#test_query_parameter_collection_format) | **PUT** /fake/test-query-parameters | - - -# **fake_any_type_request_body** -> fake_any_type_request_body(body=body) - -test any type request body - -### Example - -```python -import time -import os -import petstore_api -from petstore_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - - -# Enter a context with an instance of the API client -async with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) - body = None # object | (optional) - - try: - # test any type request body - await api_instance.fake_any_type_request_body(body=body) - except Exception as e: - print("Exception when calling FakeApi->fake_any_type_request_body: %s\n" % e) -``` - - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | **object**| | [optional] - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: Not defined - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | OK | - | - -[[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_enum_ref_query_parameter** -> fake_enum_ref_query_parameter(enum_ref=enum_ref) - -test enum reference query parameter - -### Example - -```python -import time -import os -import petstore_api -from petstore_api.models.enum_class import EnumClass -from petstore_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - - -# Enter a context with an instance of the API client -async with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) - enum_ref = petstore_api.EnumClass() # EnumClass | enum reference (optional) - - try: - # test enum reference query parameter - await api_instance.fake_enum_ref_query_parameter(enum_ref=enum_ref) - except Exception as e: - print("Exception when calling FakeApi->fake_enum_ref_query_parameter: %s\n" % e) -``` - - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **enum_ref** | [**EnumClass**](.md)| enum reference | [optional] - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Get successful | - | - -[[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_health_get** -> HealthCheckResult fake_health_get() - -Health check endpoint - -### Example - -```python -import time -import os -import petstore_api -from petstore_api.models.health_check_result import HealthCheckResult -from petstore_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - - -# Enter a context with an instance of the API client -async with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) - - try: - # Health check endpoint - api_response = await api_instance.fake_health_get() - print("The response of FakeApi->fake_health_get:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling FakeApi->fake_health_get: %s\n" % e) -``` - - - -### Parameters -This endpoint does not need any parameter. - -### Return type - -[**HealthCheckResult**](HealthCheckResult.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | The instance started successfully | - | - -[[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_http_signature_test** -> fake_http_signature_test(pet, query_1=query_1, header_1=header_1) - -test http signature authentication - -### Example - -```python -import time -import os -import petstore_api -from petstore_api.models.pet import Pet -from petstore_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - -# The client must configure the authentication and authorization parameters -# in accordance with the API server security policy. -# Examples for each auth method are provided below, use the example that -# satisfies your auth use case. - -# Configure HTTP message signature: http_signature_test -# The HTTP Signature Header mechanism that can be used by a client to -# authenticate the sender of a message and ensure that particular headers -# have not been modified in transit. -# -# You can specify the signing key-id, private key path, signing scheme, -# signing algorithm, list of signed headers and signature max validity. -# The 'key_id' parameter is an opaque string that the API server can use -# to lookup the client and validate the signature. -# The 'private_key_path' parameter should be the path to a file that -# contains a DER or base-64 encoded private key. -# The 'private_key_passphrase' parameter is optional. Set the passphrase -# if the private key is encrypted. -# The 'signed_headers' parameter is used to specify the list of -# HTTP headers included when generating the signature for the message. -# You can specify HTTP headers that you want to protect with a cryptographic -# signature. Note that proxies may add, modify or remove HTTP headers -# for legitimate reasons, so you should only add headers that you know -# will not be modified. For example, if you want to protect the HTTP request -# body, you can specify the Digest header. In that case, the client calculates -# the digest of the HTTP request body and includes the digest in the message -# signature. -# The 'signature_max_validity' parameter is optional. It is configured as a -# duration to express when the signature ceases to be valid. The client calculates -# the expiration date every time it generates the cryptographic signature -# of an HTTP request. The API server may have its own security policy -# that controls the maximum validity of the signature. The client max validity -# must be lower than the server max validity. -# The time on the client and server must be synchronized, otherwise the -# server may reject the client signature. -# -# The client must use a combination of private key, signing scheme, -# signing algorithm and hash algorithm that matches the security policy of -# the API server. -# -# See petstore_api.signing for a list of all supported parameters. -from petstore_api import signing -import datetime - -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2", - signing_info = petstore_api.HttpSigningConfiguration( - key_id = 'my-key-id', - private_key_path = 'private_key.pem', - private_key_passphrase = 'YOUR_PASSPHRASE', - signing_scheme = petstore_api.signing.SCHEME_HS2019, - signing_algorithm = petstore_api.signing.ALGORITHM_ECDSA_MODE_FIPS_186_3, - hash_algorithm = petstore_api.signing.SCHEME_RSA_SHA256, - signed_headers = [ - petstore_api.signing.HEADER_REQUEST_TARGET, - petstore_api.signing.HEADER_CREATED, - petstore_api.signing.HEADER_EXPIRES, - petstore_api.signing.HEADER_HOST, - petstore_api.signing.HEADER_DATE, - petstore_api.signing.HEADER_DIGEST, - 'Content-Type', - 'Content-Length', - 'User-Agent' - ], - signature_max_validity = datetime.timedelta(minutes=5) - ) -) - -# Enter a context with an instance of the API client -async with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) - pet = petstore_api.Pet() # Pet | Pet object that needs to be added to the store - query_1 = 'query_1_example' # str | query parameter (optional) - header_1 = 'header_1_example' # str | header parameter (optional) - - try: - # test http signature authentication - await api_instance.fake_http_signature_test(pet, query_1=query_1, header_1=header_1) - except Exception as e: - print("Exception when calling FakeApi->fake_http_signature_test: %s\n" % e) -``` - - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | - **query_1** | **str**| query parameter | [optional] - **header_1** | **str**| header parameter | [optional] - -### Return type - -void (empty response body) - -### Authorization - -[http_signature_test](../README.md#http_signature_test) - -### HTTP request headers - - - **Content-Type**: application/json, application/xml - - **Accept**: Not defined - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | The instance started successfully | - | - -[[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_boolean_serialize** -> bool fake_outer_boolean_serialize(body=body) - - - -Test serialization of outer boolean types - -### Example - -```python -import time -import os -import petstore_api -from petstore_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - - -# Enter a context with an instance of the API client -async with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) - body = True # bool | Input boolean as post body (optional) - - try: - api_response = await api_instance.fake_outer_boolean_serialize(body=body) - print("The response of FakeApi->fake_outer_boolean_serialize:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling FakeApi->fake_outer_boolean_serialize: %s\n" % e) -``` - - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | **bool**| Input boolean as post body | [optional] - -### Return type - -**bool** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: */* - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Output boolean | - | - -[[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_composite_serialize** -> OuterComposite fake_outer_composite_serialize(outer_composite=outer_composite) - - - -Test serialization of object with outer number type - -### Example - -```python -import time -import os -import petstore_api -from petstore_api.models.outer_composite import OuterComposite -from petstore_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - - -# Enter a context with an instance of the API client -async with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) - outer_composite = petstore_api.OuterComposite() # OuterComposite | Input composite as post body (optional) - - try: - api_response = await api_instance.fake_outer_composite_serialize(outer_composite=outer_composite) - print("The response of FakeApi->fake_outer_composite_serialize:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling FakeApi->fake_outer_composite_serialize: %s\n" % e) -``` - - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **outer_composite** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional] - -### Return type - -[**OuterComposite**](OuterComposite.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: */* - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Output composite | - | - -[[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(body=body) - - - -Test serialization of outer number types - -### Example - -```python -import time -import os -import petstore_api -from petstore_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - - -# Enter a context with an instance of the API client -async with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) - body = 3.4 # float | Input number as post body (optional) - - try: - api_response = await api_instance.fake_outer_number_serialize(body=body) - print("The response of FakeApi->fake_outer_number_serialize:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling FakeApi->fake_outer_number_serialize: %s\n" % e) -``` - - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | **float**| Input number as post body | [optional] - -### Return type - -**float** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: */* - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Output number | - | - -[[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_string_serialize** -> str fake_outer_string_serialize(body=body) - - - -Test serialization of outer string types - -### Example - -```python -import time -import os -import petstore_api -from petstore_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - - -# Enter a context with an instance of the API client -async with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) - body = 'body_example' # str | Input string as post body (optional) - - try: - api_response = await api_instance.fake_outer_string_serialize(body=body) - print("The response of FakeApi->fake_outer_string_serialize:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling FakeApi->fake_outer_string_serialize: %s\n" % e) -``` - - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | **str**| Input string as post body | [optional] - -### Return type - -**str** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: */* - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Output string | - | - -[[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_property_enum_integer_serialize** -> OuterObjectWithEnumProperty fake_property_enum_integer_serialize(outer_object_with_enum_property) - - - -Test serialization of enum (int) properties with examples - -### Example - -```python -import time -import os -import petstore_api -from petstore_api.models.outer_object_with_enum_property import OuterObjectWithEnumProperty -from petstore_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - - -# Enter a context with an instance of the API client -async with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) - outer_object_with_enum_property = petstore_api.OuterObjectWithEnumProperty() # OuterObjectWithEnumProperty | Input enum (int) as post body - - try: - api_response = await api_instance.fake_property_enum_integer_serialize(outer_object_with_enum_property) - print("The response of FakeApi->fake_property_enum_integer_serialize:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling FakeApi->fake_property_enum_integer_serialize: %s\n" % e) -``` - - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **outer_object_with_enum_property** | [**OuterObjectWithEnumProperty**](OuterObjectWithEnumProperty.md)| Input enum (int) as post body | - -### Return type - -[**OuterObjectWithEnumProperty**](OuterObjectWithEnumProperty.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: */* - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Output enum (int) | - | - -[[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_return_list_of_objects** -> List[List[Tag]] fake_return_list_of_objects() - -test returning list of objects - -### Example - -```python -import time -import os -import petstore_api -from petstore_api.models.tag import Tag -from petstore_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - - -# Enter a context with an instance of the API client -async with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) - - try: - # test returning list of objects - api_response = await api_instance.fake_return_list_of_objects() - print("The response of FakeApi->fake_return_list_of_objects:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling FakeApi->fake_return_list_of_objects: %s\n" % e) -``` - - - -### Parameters -This endpoint does not need any parameter. - -### Return type - -**List[List[Tag]]** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | OK | - | - -[[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_uuid_example** -> fake_uuid_example(uuid_example) - -test uuid example - -### Example - -```python -import time -import os -import petstore_api -from petstore_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - - -# Enter a context with an instance of the API client -async with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) - uuid_example = '84529ad2-2265-4e15-b76b-c17025d848f6' # str | uuid example - - try: - # test uuid example - await api_instance.fake_uuid_example(uuid_example) - except Exception as e: - print("Exception when calling FakeApi->fake_uuid_example: %s\n" % e) -``` - - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **uuid_example** | **str**| uuid example | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Get successful | - | - -[[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) - -# **test_body_with_binary** -> test_body_with_binary(body) - - - -For this test, the body has to be a binary file. - -### Example - -```python -import time -import os -import petstore_api -from petstore_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - - -# Enter a context with an instance of the API client -async with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) - body = None # bytearray | image to upload - - try: - await api_instance.test_body_with_binary(body) - except Exception as e: - print("Exception when calling FakeApi->test_body_with_binary: %s\n" % e) -``` - - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | **bytearray**| image to upload | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: image/png - - **Accept**: Not defined - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Success | - | - -[[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) - -# **test_body_with_file_schema** -> test_body_with_file_schema(file_schema_test_class) - - - -For this test, the body for this request must reference a schema named `File`. - -### Example - -```python -import time -import os -import petstore_api -from petstore_api.models.file_schema_test_class import FileSchemaTestClass -from petstore_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - - -# Enter a context with an instance of the API client -async with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) - file_schema_test_class = petstore_api.FileSchemaTestClass() # FileSchemaTestClass | - - try: - await api_instance.test_body_with_file_schema(file_schema_test_class) - except Exception as e: - print("Exception when calling FakeApi->test_body_with_file_schema: %s\n" % e) -``` - - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **file_schema_test_class** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: Not defined - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Success | - | - -[[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) - -# **test_body_with_query_params** -> test_body_with_query_params(query, user) - - - -### Example - -```python -import time -import os -import petstore_api -from petstore_api.models.user import User -from petstore_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - - -# Enter a context with an instance of the API client -async with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) - query = 'query_example' # str | - user = petstore_api.User() # User | - - try: - await api_instance.test_body_with_query_params(query, user) - except Exception as e: - print("Exception when calling FakeApi->test_body_with_query_params: %s\n" % e) -``` - - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **query** | **str**| | - **user** | [**User**](User.md)| | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: Not defined - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Success | - | - -[[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) - -# **test_client_model** -> Client test_client_model(client) - -To test \"client\" model - -To test \"client\" model - -### Example - -```python -import time -import os -import petstore_api -from petstore_api.models.client import Client -from petstore_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - - -# Enter a context with an instance of the API client -async with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) - client = petstore_api.Client() # Client | client model - - try: - # To test \"client\" model - api_response = await api_instance.test_client_model(client) - print("The response of FakeApi->test_client_model:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling FakeApi->test_client_model: %s\n" % e) -``` - - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **client** | [**Client**](Client.md)| client model | - -### Return type - -[**Client**](Client.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | successful operation | - | - -[[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) - -# **test_date_time_query_parameter** -> test_date_time_query_parameter(date_time_query, str_query) - - - -### Example - -```python -import time -import os -import petstore_api -from petstore_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - - -# Enter a context with an instance of the API client -async with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) - date_time_query = '2013-10-20T19:20:30+01:00' # datetime | - str_query = 'str_query_example' # str | - - try: - await api_instance.test_date_time_query_parameter(date_time_query, str_query) - except Exception as e: - print("Exception when calling FakeApi->test_date_time_query_parameter: %s\n" % e) -``` - - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **date_time_query** | **datetime**| | - **str_query** | **str**| | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Success | - | - -[[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) - -# **test_endpoint_parameters** -> test_endpoint_parameters(number, double, pattern_without_delimiter, byte, integer=integer, int32=int32, int64=int64, float=float, string=string, binary=binary, byte_with_max_length=byte_with_max_length, var_date=var_date, date_time=date_time, password=password, param_callback=param_callback) - -Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - -Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - -### Example - -* Basic Authentication (http_basic_test): -```python -import time -import os -import petstore_api -from petstore_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - -# The client must configure the authentication and authorization parameters -# in accordance with the API server security policy. -# Examples for each auth method are provided below, use the example that -# satisfies your auth use case. - -# Configure HTTP basic authorization: http_basic_test -configuration = petstore_api.Configuration( - username = os.environ["USERNAME"], - password = os.environ["PASSWORD"] -) - -# Enter a context with an instance of the API client -async with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) - number = 3.4 # float | None - double = 3.4 # float | None - pattern_without_delimiter = 'pattern_without_delimiter_example' # str | None - byte = None # bytearray | None - integer = 56 # int | None (optional) - int32 = 56 # int | None (optional) - int64 = 56 # int | None (optional) - float = 3.4 # float | None (optional) - string = 'string_example' # str | None (optional) - binary = None # bytearray | None (optional) - byte_with_max_length = None # bytearray | None (optional) - var_date = '2013-10-20' # date | None (optional) - date_time = '2013-10-20T19:20:30+01:00' # datetime | None (optional) - password = 'password_example' # str | None (optional) - param_callback = 'param_callback_example' # str | None (optional) - - try: - # Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - await api_instance.test_endpoint_parameters(number, double, pattern_without_delimiter, byte, integer=integer, int32=int32, int64=int64, float=float, string=string, binary=binary, byte_with_max_length=byte_with_max_length, var_date=var_date, date_time=date_time, password=password, param_callback=param_callback) - except Exception as e: - print("Exception when calling FakeApi->test_endpoint_parameters: %s\n" % e) -``` - - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **number** | **float**| None | - **double** | **float**| None | - **pattern_without_delimiter** | **str**| None | - **byte** | **bytearray**| None | - **integer** | **int**| None | [optional] - **int32** | **int**| None | [optional] - **int64** | **int**| None | [optional] - **float** | **float**| None | [optional] - **string** | **str**| None | [optional] - **binary** | **bytearray**| None | [optional] - **byte_with_max_length** | **bytearray**| None | [optional] - **var_date** | **date**| None | [optional] - **date_time** | **datetime**| None | [optional] - **password** | **str**| None | [optional] - **param_callback** | **str**| None | [optional] - -### Return type - -void (empty response body) - -### Authorization - -[http_basic_test](../README.md#http_basic_test) - -### HTTP request headers - - - **Content-Type**: application/x-www-form-urlencoded - - **Accept**: Not defined - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**400** | Invalid username supplied | - | -**404** | User not found | - | - -[[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) - -# **test_group_parameters** -> test_group_parameters(required_string_group, required_boolean_group, required_int64_group, string_group=string_group, boolean_group=boolean_group, int64_group=int64_group) - -Fake endpoint to test group parameters (optional) - -Fake endpoint to test group parameters (optional) - -### Example - -* Bearer (JWT) Authentication (bearer_test): -```python -import time -import os -import petstore_api -from petstore_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - -# The client must configure the authentication and authorization parameters -# in accordance with the API server security policy. -# Examples for each auth method are provided below, use the example that -# satisfies your auth use case. - -# Configure Bearer authorization (JWT): bearer_test -configuration = petstore_api.Configuration( - access_token = os.environ["BEARER_TOKEN"] -) - -# Enter a context with an instance of the API client -async with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) - required_string_group = 56 # int | Required String in group parameters - required_boolean_group = True # bool | Required Boolean in group parameters - required_int64_group = 56 # int | Required Integer in group parameters - string_group = 56 # int | String in group parameters (optional) - boolean_group = True # bool | Boolean in group parameters (optional) - int64_group = 56 # int | Integer in group parameters (optional) - - try: - # Fake endpoint to test group parameters (optional) - await api_instance.test_group_parameters(required_string_group, required_boolean_group, required_int64_group, string_group=string_group, boolean_group=boolean_group, int64_group=int64_group) - except Exception as e: - print("Exception when calling FakeApi->test_group_parameters: %s\n" % e) -``` - - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **required_string_group** | **int**| Required String in group parameters | - **required_boolean_group** | **bool**| Required Boolean in group parameters | - **required_int64_group** | **int**| Required Integer in group parameters | - **string_group** | **int**| String in group parameters | [optional] - **boolean_group** | **bool**| Boolean in group parameters | [optional] - **int64_group** | **int**| Integer in group parameters | [optional] - -### Return type - -void (empty response body) - -### Authorization - -[bearer_test](../README.md#bearer_test) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**400** | Someting wrong | - | - -[[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) - -# **test_inline_additional_properties** -> test_inline_additional_properties(request_body) - -test inline additionalProperties - - - -### Example - -```python -import time -import os -import petstore_api -from petstore_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - - -# Enter a context with an instance of the API client -async with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) - request_body = {'key': 'request_body_example'} # Dict[str, str] | request body - - try: - # test inline additionalProperties - await api_instance.test_inline_additional_properties(request_body) - except Exception as e: - print("Exception when calling FakeApi->test_inline_additional_properties: %s\n" % e) -``` - - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **request_body** | [**Dict[str, str]**](str.md)| request body | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: Not defined - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | successful operation | - | - -[[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) - -# **test_inline_freeform_additional_properties** -> test_inline_freeform_additional_properties(test_inline_freeform_additional_properties_request) - -test inline free-form additionalProperties - - - -### Example - -```python -import time -import os -import petstore_api -from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest -from petstore_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - - -# Enter a context with an instance of the API client -async with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) - test_inline_freeform_additional_properties_request = petstore_api.TestInlineFreeformAdditionalPropertiesRequest() # TestInlineFreeformAdditionalPropertiesRequest | request body - - try: - # test inline free-form additionalProperties - await api_instance.test_inline_freeform_additional_properties(test_inline_freeform_additional_properties_request) - except Exception as e: - print("Exception when calling FakeApi->test_inline_freeform_additional_properties: %s\n" % e) -``` - - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **test_inline_freeform_additional_properties_request** | [**TestInlineFreeformAdditionalPropertiesRequest**](TestInlineFreeformAdditionalPropertiesRequest.md)| request body | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: Not defined - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | successful operation | - | - -[[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) - -# **test_json_form_data** -> test_json_form_data(param, param2) - -test json serialization of form data - - - -### Example - -```python -import time -import os -import petstore_api -from petstore_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - - -# Enter a context with an instance of the API client -async with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) - param = 'param_example' # str | field1 - param2 = 'param2_example' # str | field2 - - try: - # test json serialization of form data - await api_instance.test_json_form_data(param, param2) - except Exception as e: - print("Exception when calling FakeApi->test_json_form_data: %s\n" % e) -``` - - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **param** | **str**| field1 | - **param2** | **str**| field2 | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/x-www-form-urlencoded - - **Accept**: Not defined - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | successful operation | - | - -[[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) - -# **test_query_parameter_collection_format** -> test_query_parameter_collection_format(pipe, ioutil, http, url, context, allow_empty, language=language) - - - -To test the collection format in query parameters - -### Example - -```python -import time -import os -import petstore_api -from petstore_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - - -# Enter a context with an instance of the API client -async with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) - pipe = ['pipe_example'] # List[str] | - ioutil = ['ioutil_example'] # List[str] | - http = ['http_example'] # List[str] | - url = ['url_example'] # List[str] | - context = ['context_example'] # List[str] | - allow_empty = 'allow_empty_example' # str | - language = {'key': 'language_example'} # Dict[str, str] | (optional) - - try: - await api_instance.test_query_parameter_collection_format(pipe, ioutil, http, url, context, allow_empty, language=language) - except Exception as e: - print("Exception when calling FakeApi->test_query_parameter_collection_format: %s\n" % e) -``` - - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **pipe** | [**List[str]**](str.md)| | - **ioutil** | [**List[str]**](str.md)| | - **http** | [**List[str]**](str.md)| | - **url** | [**List[str]**](str.md)| | - **context** | [**List[str]**](str.md)| | - **allow_empty** | **str**| | - **language** | [**Dict[str, str]**](str.md)| | [optional] - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Success | - | - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FakeClassnameTags123Api.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FakeClassnameTags123Api.md deleted file mode 100644 index 3f833a270cd7..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FakeClassnameTags123Api.md +++ /dev/null @@ -1,87 +0,0 @@ -# petstore_api.FakeClassnameTags123Api - -All URIs are relative to *http://petstore.swagger.io:80/v2* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**test_classname**](FakeClassnameTags123Api.md#test_classname) | **PATCH** /fake_classname_test | To test class name in snake case - - -# **test_classname** -> Client test_classname(client) - -To test class name in snake case - -To test class name in snake case - -### Example - -* Api Key Authentication (api_key_query): -```python -import time -import os -import petstore_api -from petstore_api.models.client import Client -from petstore_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - -# The client must configure the authentication and authorization parameters -# in accordance with the API server security policy. -# Examples for each auth method are provided below, use the example that -# satisfies your auth use case. - -# Configure API key authorization: api_key_query -configuration.api_key['api_key_query'] = os.environ["API_KEY"] - -# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -# configuration.api_key_prefix['api_key_query'] = 'Bearer' - -# Enter a context with an instance of the API client -async with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.FakeClassnameTags123Api(api_client) - client = petstore_api.Client() # Client | client model - - try: - # To test class name in snake case - api_response = await api_instance.test_classname(client) - print("The response of FakeClassnameTags123Api->test_classname:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling FakeClassnameTags123Api->test_classname: %s\n" % e) -``` - - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **client** | [**Client**](Client.md)| client model | - -### Return type - -[**Client**](Client.md) - -### Authorization - -[api_key_query](../README.md#api_key_query) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | successful operation | - | - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/File.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/File.md deleted file mode 100644 index 586da8e32559..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/File.md +++ /dev/null @@ -1,29 +0,0 @@ -# File - -Must be named `File` for test. - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**source_uri** | **str** | Test capitalization | [optional] - -## Example - -```python -from petstore_api.models.file import File - -# TODO update the JSON string below -json = "{}" -# create an instance of File from a JSON string -file_instance = File.from_json(json) -# print the JSON string representation of the object -print File.to_json() - -# convert the object into a dict -file_dict = file_instance.to_dict() -# create an instance of File from a dict -file_form_dict = file.from_dict(file_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FileSchemaTestClass.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FileSchemaTestClass.md deleted file mode 100644 index fb967a8d9924..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FileSchemaTestClass.md +++ /dev/null @@ -1,29 +0,0 @@ -# FileSchemaTestClass - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**file** | [**File**](File.md) | | [optional] -**files** | [**List[File]**](File.md) | | [optional] - -## Example - -```python -from petstore_api.models.file_schema_test_class import FileSchemaTestClass - -# TODO update the JSON string below -json = "{}" -# create an instance of FileSchemaTestClass from a JSON string -file_schema_test_class_instance = FileSchemaTestClass.from_json(json) -# print the JSON string representation of the object -print FileSchemaTestClass.to_json() - -# convert the object into a dict -file_schema_test_class_dict = file_schema_test_class_instance.to_dict() -# create an instance of FileSchemaTestClass from a dict -file_schema_test_class_form_dict = file_schema_test_class.from_dict(file_schema_test_class_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FirstRef.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FirstRef.md deleted file mode 100644 index b5e7ab766b45..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FirstRef.md +++ /dev/null @@ -1,29 +0,0 @@ -# FirstRef - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**category** | **str** | | [optional] -**self_ref** | [**SecondRef**](SecondRef.md) | | [optional] - -## Example - -```python -from petstore_api.models.first_ref import FirstRef - -# TODO update the JSON string below -json = "{}" -# create an instance of FirstRef from a JSON string -first_ref_instance = FirstRef.from_json(json) -# print the JSON string representation of the object -print FirstRef.to_json() - -# convert the object into a dict -first_ref_dict = first_ref_instance.to_dict() -# create an instance of FirstRef from a dict -first_ref_form_dict = first_ref.from_dict(first_ref_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Foo.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Foo.md deleted file mode 100644 index 8062d08df1dd..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Foo.md +++ /dev/null @@ -1,28 +0,0 @@ -# Foo - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**bar** | **str** | | [optional] [default to 'bar'] - -## Example - -```python -from petstore_api.models.foo import Foo - -# TODO update the JSON string below -json = "{}" -# create an instance of Foo from a JSON string -foo_instance = Foo.from_json(json) -# print the JSON string representation of the object -print Foo.to_json() - -# convert the object into a dict -foo_dict = foo_instance.to_dict() -# create an instance of Foo from a dict -foo_form_dict = foo.from_dict(foo_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FooGetDefaultResponse.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FooGetDefaultResponse.md deleted file mode 100644 index 550fbe78fa17..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FooGetDefaultResponse.md +++ /dev/null @@ -1,28 +0,0 @@ -# FooGetDefaultResponse - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**string** | [**Foo**](Foo.md) | | [optional] - -## Example - -```python -from petstore_api.models.foo_get_default_response import FooGetDefaultResponse - -# TODO update the JSON string below -json = "{}" -# create an instance of FooGetDefaultResponse from a JSON string -foo_get_default_response_instance = FooGetDefaultResponse.from_json(json) -# print the JSON string representation of the object -print FooGetDefaultResponse.to_json() - -# convert the object into a dict -foo_get_default_response_dict = foo_get_default_response_instance.to_dict() -# create an instance of FooGetDefaultResponse from a dict -foo_get_default_response_form_dict = foo_get_default_response.from_dict(foo_get_default_response_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FormatTest.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FormatTest.md deleted file mode 100644 index aa81e585952f..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FormatTest.md +++ /dev/null @@ -1,44 +0,0 @@ -# FormatTest - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**integer** | **int** | | [optional] -**int32** | **int** | | [optional] -**int64** | **int** | | [optional] -**number** | **float** | | -**float** | **float** | | [optional] -**double** | **float** | | [optional] -**decimal** | **decimal.Decimal** | | [optional] -**string** | **str** | | [optional] -**string_with_double_quote_pattern** | **str** | | [optional] -**byte** | **bytearray** | | [optional] -**binary** | **bytearray** | | [optional] -**var_date** | **date** | | -**date_time** | **datetime** | | [optional] -**uuid** | **str** | | [optional] -**password** | **str** | | -**pattern_with_digits** | **str** | A string that is a 10 digit number. Can have leading zeros. | [optional] -**pattern_with_digits_and_delimiter** | **str** | A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. | [optional] - -## Example - -```python -from petstore_api.models.format_test import FormatTest - -# TODO update the JSON string below -json = "{}" -# create an instance of FormatTest from a JSON string -format_test_instance = FormatTest.from_json(json) -# print the JSON string representation of the object -print FormatTest.to_json() - -# convert the object into a dict -format_test_dict = format_test_instance.to_dict() -# create an instance of FormatTest from a dict -format_test_form_dict = format_test.from_dict(format_test_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/HasOnlyReadOnly.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/HasOnlyReadOnly.md deleted file mode 100644 index 99573bd28a2f..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/HasOnlyReadOnly.md +++ /dev/null @@ -1,29 +0,0 @@ -# HasOnlyReadOnly - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**bar** | **str** | | [optional] [readonly] -**foo** | **str** | | [optional] [readonly] - -## Example - -```python -from petstore_api.models.has_only_read_only import HasOnlyReadOnly - -# TODO update the JSON string below -json = "{}" -# create an instance of HasOnlyReadOnly from a JSON string -has_only_read_only_instance = HasOnlyReadOnly.from_json(json) -# print the JSON string representation of the object -print HasOnlyReadOnly.to_json() - -# convert the object into a dict -has_only_read_only_dict = has_only_read_only_instance.to_dict() -# create an instance of HasOnlyReadOnly from a dict -has_only_read_only_form_dict = has_only_read_only.from_dict(has_only_read_only_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/HealthCheckResult.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/HealthCheckResult.md deleted file mode 100644 index b8723e018aa1..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/HealthCheckResult.md +++ /dev/null @@ -1,29 +0,0 @@ -# HealthCheckResult - -Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**nullable_message** | **str** | | [optional] - -## Example - -```python -from petstore_api.models.health_check_result import HealthCheckResult - -# TODO update the JSON string below -json = "{}" -# create an instance of HealthCheckResult from a JSON string -health_check_result_instance = HealthCheckResult.from_json(json) -# print the JSON string representation of the object -print HealthCheckResult.to_json() - -# convert the object into a dict -health_check_result_dict = health_check_result_instance.to_dict() -# create an instance of HealthCheckResult from a dict -health_check_result_form_dict = health_check_result.from_dict(health_check_result_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/InnerDictWithProperty.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/InnerDictWithProperty.md deleted file mode 100644 index 45d76ad458c4..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/InnerDictWithProperty.md +++ /dev/null @@ -1,28 +0,0 @@ -# InnerDictWithProperty - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**a_property** | **object** | | [optional] - -## Example - -```python -from petstore_api.models.inner_dict_with_property import InnerDictWithProperty - -# TODO update the JSON string below -json = "{}" -# create an instance of InnerDictWithProperty from a JSON string -inner_dict_with_property_instance = InnerDictWithProperty.from_json(json) -# print the JSON string representation of the object -print InnerDictWithProperty.to_json() - -# convert the object into a dict -inner_dict_with_property_dict = inner_dict_with_property_instance.to_dict() -# create an instance of InnerDictWithProperty from a dict -inner_dict_with_property_form_dict = inner_dict_with_property.from_dict(inner_dict_with_property_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/IntOrString.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/IntOrString.md deleted file mode 100644 index 0a441f186dbc..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/IntOrString.md +++ /dev/null @@ -1,27 +0,0 @@ -# IntOrString - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -## Example - -```python -from petstore_api.models.int_or_string import IntOrString - -# TODO update the JSON string below -json = "{}" -# create an instance of IntOrString from a JSON string -int_or_string_instance = IntOrString.from_json(json) -# print the JSON string representation of the object -print IntOrString.to_json() - -# convert the object into a dict -int_or_string_dict = int_or_string_instance.to_dict() -# create an instance of IntOrString from a dict -int_or_string_form_dict = int_or_string.from_dict(int_or_string_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/List.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/List.md deleted file mode 100644 index 7643e4ea92dd..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/List.md +++ /dev/null @@ -1,28 +0,0 @@ -# List - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**var_123_list** | **str** | | [optional] - -## Example - -```python -from petstore_api.models.list import List - -# TODO update the JSON string below -json = "{}" -# create an instance of List from a JSON string -list_instance = List.from_json(json) -# print the JSON string representation of the object -print List.to_json() - -# convert the object into a dict -list_dict = list_instance.to_dict() -# create an instance of List from a dict -list_form_dict = list.from_dict(list_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/MapOfArrayOfModel.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/MapOfArrayOfModel.md deleted file mode 100644 index b97ace0f42c8..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/MapOfArrayOfModel.md +++ /dev/null @@ -1,28 +0,0 @@ -# MapOfArrayOfModel - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**shop_id_to_org_online_lip_map** | **Dict[str, List[Tag]]** | | [optional] - -## Example - -```python -from petstore_api.models.map_of_array_of_model import MapOfArrayOfModel - -# TODO update the JSON string below -json = "{}" -# create an instance of MapOfArrayOfModel from a JSON string -map_of_array_of_model_instance = MapOfArrayOfModel.from_json(json) -# print the JSON string representation of the object -print MapOfArrayOfModel.to_json() - -# convert the object into a dict -map_of_array_of_model_dict = map_of_array_of_model_instance.to_dict() -# create an instance of MapOfArrayOfModel from a dict -map_of_array_of_model_form_dict = map_of_array_of_model.from_dict(map_of_array_of_model_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/MapTest.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/MapTest.md deleted file mode 100644 index ba87758a5220..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/MapTest.md +++ /dev/null @@ -1,31 +0,0 @@ -# MapTest - - -## Properties -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] - -## Example - -```python -from petstore_api.models.map_test import MapTest - -# TODO update the JSON string below -json = "{}" -# create an instance of MapTest from a JSON string -map_test_instance = MapTest.from_json(json) -# print the JSON string representation of the object -print MapTest.to_json() - -# convert the object into a dict -map_test_dict = map_test_instance.to_dict() -# create an instance of MapTest from a dict -map_test_form_dict = map_test.from_dict(map_test_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/MixedPropertiesAndAdditionalPropertiesClass.md deleted file mode 100644 index 8f628d133abf..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/MixedPropertiesAndAdditionalPropertiesClass.md +++ /dev/null @@ -1,30 +0,0 @@ -# MixedPropertiesAndAdditionalPropertiesClass - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**uuid** | **str** | | [optional] -**date_time** | **datetime** | | [optional] -**map** | [**Dict[str, Animal]**](Animal.md) | | [optional] - -## Example - -```python -from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass - -# TODO update the JSON string below -json = "{}" -# create an instance of MixedPropertiesAndAdditionalPropertiesClass from a JSON string -mixed_properties_and_additional_properties_class_instance = MixedPropertiesAndAdditionalPropertiesClass.from_json(json) -# print the JSON string representation of the object -print MixedPropertiesAndAdditionalPropertiesClass.to_json() - -# convert the object into a dict -mixed_properties_and_additional_properties_class_dict = mixed_properties_and_additional_properties_class_instance.to_dict() -# create an instance of MixedPropertiesAndAdditionalPropertiesClass from a dict -mixed_properties_and_additional_properties_class_form_dict = mixed_properties_and_additional_properties_class.from_dict(mixed_properties_and_additional_properties_class_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Model200Response.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Model200Response.md deleted file mode 100644 index 6a20cefe99cb..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Model200Response.md +++ /dev/null @@ -1,30 +0,0 @@ -# Model200Response - -Model for testing model name starting with number - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**name** | **int** | | [optional] -**var_class** | **str** | | [optional] - -## Example - -```python -from petstore_api.models.model200_response import Model200Response - -# TODO update the JSON string below -json = "{}" -# create an instance of Model200Response from a JSON string -model200_response_instance = Model200Response.from_json(json) -# print the JSON string representation of the object -print Model200Response.to_json() - -# convert the object into a dict -model200_response_dict = model200_response_instance.to_dict() -# create an instance of Model200Response from a dict -model200_response_form_dict = model200_response.from_dict(model200_response_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ModelReturn.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ModelReturn.md deleted file mode 100644 index a5b47f423c81..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ModelReturn.md +++ /dev/null @@ -1,29 +0,0 @@ -# ModelReturn - -Model for testing reserved words - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**var_return** | **int** | | [optional] - -## Example - -```python -from petstore_api.models.model_return import ModelReturn - -# TODO update the JSON string below -json = "{}" -# create an instance of ModelReturn from a JSON string -model_return_instance = ModelReturn.from_json(json) -# print the JSON string representation of the object -print ModelReturn.to_json() - -# convert the object into a dict -model_return_dict = model_return_instance.to_dict() -# create an instance of ModelReturn from a dict -model_return_form_dict = model_return.from_dict(model_return_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Name.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Name.md deleted file mode 100644 index 4ccd0ce09aa2..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Name.md +++ /dev/null @@ -1,32 +0,0 @@ -# Name - -Model for testing model name same as property name - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**name** | **int** | | -**snake_case** | **int** | | [optional] [readonly] -**var_property** | **str** | | [optional] -**var_123_number** | **int** | | [optional] [readonly] - -## Example - -```python -from petstore_api.models.name import Name - -# TODO update the JSON string below -json = "{}" -# create an instance of Name from a JSON string -name_instance = Name.from_json(json) -# print the JSON string representation of the object -print Name.to_json() - -# convert the object into a dict -name_dict = name_instance.to_dict() -# create an instance of Name from a dict -name_form_dict = name.from_dict(name_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/NullableClass.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/NullableClass.md deleted file mode 100644 index 1658756b50e4..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/NullableClass.md +++ /dev/null @@ -1,40 +0,0 @@ -# NullableClass - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**required_integer_prop** | **int** | | -**integer_prop** | **int** | | [optional] -**number_prop** | **float** | | [optional] -**boolean_prop** | **bool** | | [optional] -**string_prop** | **str** | | [optional] -**date_prop** | **date** | | [optional] -**datetime_prop** | **datetime** | | [optional] -**array_nullable_prop** | **List[object]** | | [optional] -**array_and_items_nullable_prop** | **List[object]** | | [optional] -**array_items_nullable** | **List[object]** | | [optional] -**object_nullable_prop** | **Dict[str, object]** | | [optional] -**object_and_items_nullable_prop** | **Dict[str, object]** | | [optional] -**object_items_nullable** | **Dict[str, object]** | | [optional] - -## Example - -```python -from petstore_api.models.nullable_class import NullableClass - -# TODO update the JSON string below -json = "{}" -# create an instance of NullableClass from a JSON string -nullable_class_instance = NullableClass.from_json(json) -# print the JSON string representation of the object -print NullableClass.to_json() - -# convert the object into a dict -nullable_class_dict = nullable_class_instance.to_dict() -# create an instance of NullableClass from a dict -nullable_class_form_dict = nullable_class.from_dict(nullable_class_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/NullableProperty.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/NullableProperty.md deleted file mode 100644 index fd9cbbc51aaa..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/NullableProperty.md +++ /dev/null @@ -1,29 +0,0 @@ -# NullableProperty - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **int** | | -**name** | **str** | | - -## Example - -```python -from petstore_api.models.nullable_property import NullableProperty - -# TODO update the JSON string below -json = "{}" -# create an instance of NullableProperty from a JSON string -nullable_property_instance = NullableProperty.from_json(json) -# print the JSON string representation of the object -print NullableProperty.to_json() - -# convert the object into a dict -nullable_property_dict = nullable_property_instance.to_dict() -# create an instance of NullableProperty from a dict -nullable_property_form_dict = nullable_property.from_dict(nullable_property_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/NumberOnly.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/NumberOnly.md deleted file mode 100644 index f49216ddaa4e..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/NumberOnly.md +++ /dev/null @@ -1,28 +0,0 @@ -# NumberOnly - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**just_number** | **float** | | [optional] - -## Example - -```python -from petstore_api.models.number_only import NumberOnly - -# TODO update the JSON string below -json = "{}" -# create an instance of NumberOnly from a JSON string -number_only_instance = NumberOnly.from_json(json) -# print the JSON string representation of the object -print NumberOnly.to_json() - -# convert the object into a dict -number_only_dict = number_only_instance.to_dict() -# create an instance of NumberOnly from a dict -number_only_form_dict = number_only.from_dict(number_only_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ObjectToTestAdditionalProperties.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ObjectToTestAdditionalProperties.md deleted file mode 100644 index c4ba9a958503..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ObjectToTestAdditionalProperties.md +++ /dev/null @@ -1,29 +0,0 @@ -# ObjectToTestAdditionalProperties - -Minimal object - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**var_property** | **bool** | Property | [optional] [default to False] - -## Example - -```python -from petstore_api.models.object_to_test_additional_properties import ObjectToTestAdditionalProperties - -# TODO update the JSON string below -json = "{}" -# create an instance of ObjectToTestAdditionalProperties from a JSON string -object_to_test_additional_properties_instance = ObjectToTestAdditionalProperties.from_json(json) -# print the JSON string representation of the object -print ObjectToTestAdditionalProperties.to_json() - -# convert the object into a dict -object_to_test_additional_properties_dict = object_to_test_additional_properties_instance.to_dict() -# create an instance of ObjectToTestAdditionalProperties from a dict -object_to_test_additional_properties_form_dict = object_to_test_additional_properties.from_dict(object_to_test_additional_properties_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ObjectWithDeprecatedFields.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ObjectWithDeprecatedFields.md deleted file mode 100644 index 8daa55a39161..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ObjectWithDeprecatedFields.md +++ /dev/null @@ -1,31 +0,0 @@ -# ObjectWithDeprecatedFields - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**uuid** | **str** | | [optional] -**id** | **float** | | [optional] -**deprecated_ref** | [**DeprecatedObject**](DeprecatedObject.md) | | [optional] -**bars** | **List[str]** | | [optional] - -## Example - -```python -from petstore_api.models.object_with_deprecated_fields import ObjectWithDeprecatedFields - -# TODO update the JSON string below -json = "{}" -# create an instance of ObjectWithDeprecatedFields from a JSON string -object_with_deprecated_fields_instance = ObjectWithDeprecatedFields.from_json(json) -# print the JSON string representation of the object -print ObjectWithDeprecatedFields.to_json() - -# convert the object into a dict -object_with_deprecated_fields_dict = object_with_deprecated_fields_instance.to_dict() -# create an instance of ObjectWithDeprecatedFields from a dict -object_with_deprecated_fields_form_dict = object_with_deprecated_fields.from_dict(object_with_deprecated_fields_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OneOfEnumString.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OneOfEnumString.md deleted file mode 100644 index c7c28bc29440..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OneOfEnumString.md +++ /dev/null @@ -1,28 +0,0 @@ -# OneOfEnumString - -oneOf enum strings - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -## Example - -```python -from petstore_api.models.one_of_enum_string import OneOfEnumString - -# TODO update the JSON string below -json = "{}" -# create an instance of OneOfEnumString from a JSON string -one_of_enum_string_instance = OneOfEnumString.from_json(json) -# print the JSON string representation of the object -print OneOfEnumString.to_json() - -# convert the object into a dict -one_of_enum_string_dict = one_of_enum_string_instance.to_dict() -# create an instance of OneOfEnumString from a dict -one_of_enum_string_form_dict = one_of_enum_string.from_dict(one_of_enum_string_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Order.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Order.md deleted file mode 100644 index e71e955a11dd..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Order.md +++ /dev/null @@ -1,33 +0,0 @@ -# Order - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **int** | | [optional] -**pet_id** | **int** | | [optional] -**quantity** | **int** | | [optional] -**ship_date** | **datetime** | | [optional] -**status** | **str** | Order Status | [optional] -**complete** | **bool** | | [optional] [default to False] - -## Example - -```python -from petstore_api.models.order import Order - -# TODO update the JSON string below -json = "{}" -# create an instance of Order from a JSON string -order_instance = Order.from_json(json) -# print the JSON string representation of the object -print Order.to_json() - -# convert the object into a dict -order_dict = order_instance.to_dict() -# create an instance of Order from a dict -order_form_dict = order.from_dict(order_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OuterComposite.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OuterComposite.md deleted file mode 100644 index 504e266f9a14..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OuterComposite.md +++ /dev/null @@ -1,30 +0,0 @@ -# OuterComposite - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**my_number** | **float** | | [optional] -**my_string** | **str** | | [optional] -**my_boolean** | **bool** | | [optional] - -## Example - -```python -from petstore_api.models.outer_composite import OuterComposite - -# TODO update the JSON string below -json = "{}" -# create an instance of OuterComposite from a JSON string -outer_composite_instance = OuterComposite.from_json(json) -# print the JSON string representation of the object -print OuterComposite.to_json() - -# convert the object into a dict -outer_composite_dict = outer_composite_instance.to_dict() -# create an instance of OuterComposite from a dict -outer_composite_form_dict = outer_composite.from_dict(outer_composite_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OuterEnum.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OuterEnum.md deleted file mode 100644 index 4cb31437c7e2..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OuterEnum.md +++ /dev/null @@ -1,10 +0,0 @@ -# OuterEnum - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OuterEnumDefaultValue.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OuterEnumDefaultValue.md deleted file mode 100644 index 4a5ba6428d83..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OuterEnumDefaultValue.md +++ /dev/null @@ -1,10 +0,0 @@ -# OuterEnumDefaultValue - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OuterEnumInteger.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OuterEnumInteger.md deleted file mode 100644 index fc84ec365851..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OuterEnumInteger.md +++ /dev/null @@ -1,10 +0,0 @@ -# OuterEnumInteger - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OuterEnumIntegerDefaultValue.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OuterEnumIntegerDefaultValue.md deleted file mode 100644 index 0de4199a8401..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OuterEnumIntegerDefaultValue.md +++ /dev/null @@ -1,10 +0,0 @@ -# OuterEnumIntegerDefaultValue - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OuterObjectWithEnumProperty.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OuterObjectWithEnumProperty.md deleted file mode 100644 index c6a1cdcbc193..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OuterObjectWithEnumProperty.md +++ /dev/null @@ -1,29 +0,0 @@ -# OuterObjectWithEnumProperty - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**str_value** | [**OuterEnum**](OuterEnum.md) | | [optional] -**value** | [**OuterEnumInteger**](OuterEnumInteger.md) | | - -## Example - -```python -from petstore_api.models.outer_object_with_enum_property import OuterObjectWithEnumProperty - -# TODO update the JSON string below -json = "{}" -# create an instance of OuterObjectWithEnumProperty from a JSON string -outer_object_with_enum_property_instance = OuterObjectWithEnumProperty.from_json(json) -# print the JSON string representation of the object -print OuterObjectWithEnumProperty.to_json() - -# convert the object into a dict -outer_object_with_enum_property_dict = outer_object_with_enum_property_instance.to_dict() -# create an instance of OuterObjectWithEnumProperty from a dict -outer_object_with_enum_property_form_dict = outer_object_with_enum_property.from_dict(outer_object_with_enum_property_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Parent.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Parent.md deleted file mode 100644 index 9a963a6b722d..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Parent.md +++ /dev/null @@ -1,28 +0,0 @@ -# Parent - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**optional_dict** | [**Dict[str, InnerDictWithProperty]**](InnerDictWithProperty.md) | | [optional] - -## Example - -```python -from petstore_api.models.parent import Parent - -# TODO update the JSON string below -json = "{}" -# create an instance of Parent from a JSON string -parent_instance = Parent.from_json(json) -# print the JSON string representation of the object -print Parent.to_json() - -# convert the object into a dict -parent_dict = parent_instance.to_dict() -# create an instance of Parent from a dict -parent_form_dict = parent.from_dict(parent_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ParentWithOptionalDict.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ParentWithOptionalDict.md deleted file mode 100644 index 04bf94942019..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ParentWithOptionalDict.md +++ /dev/null @@ -1,28 +0,0 @@ -# ParentWithOptionalDict - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**optional_dict** | [**Dict[str, InnerDictWithProperty]**](InnerDictWithProperty.md) | | [optional] - -## Example - -```python -from petstore_api.models.parent_with_optional_dict import ParentWithOptionalDict - -# TODO update the JSON string below -json = "{}" -# create an instance of ParentWithOptionalDict from a JSON string -parent_with_optional_dict_instance = ParentWithOptionalDict.from_json(json) -# print the JSON string representation of the object -print ParentWithOptionalDict.to_json() - -# convert the object into a dict -parent_with_optional_dict_dict = parent_with_optional_dict_instance.to_dict() -# create an instance of ParentWithOptionalDict from a dict -parent_with_optional_dict_form_dict = parent_with_optional_dict.from_dict(parent_with_optional_dict_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Pet.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Pet.md deleted file mode 100644 index 05a466f880a3..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Pet.md +++ /dev/null @@ -1,33 +0,0 @@ -# Pet - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **int** | | [optional] -**category** | [**Category**](Category.md) | | [optional] -**name** | **str** | | -**photo_urls** | **List[str]** | | -**tags** | [**List[Tag]**](Tag.md) | | [optional] -**status** | **str** | pet status in the store | [optional] - -## Example - -```python -from petstore_api.models.pet import Pet - -# TODO update the JSON string below -json = "{}" -# create an instance of Pet from a JSON string -pet_instance = Pet.from_json(json) -# print the JSON string representation of the object -print Pet.to_json() - -# convert the object into a dict -pet_dict = pet_instance.to_dict() -# create an instance of Pet from a dict -pet_form_dict = pet.from_dict(pet_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/PetApi.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/PetApi.md deleted file mode 100644 index e6817874690a..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/PetApi.md +++ /dev/null @@ -1,953 +0,0 @@ -# petstore_api.PetApi - -All URIs are relative to *http://petstore.swagger.io:80/v2* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**add_pet**](PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store -[**delete_pet**](PetApi.md#delete_pet) | **DELETE** /pet/{petId} | Deletes a pet -[**find_pets_by_status**](PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status -[**find_pets_by_tags**](PetApi.md#find_pets_by_tags) | **GET** /pet/findByTags | Finds Pets by tags -[**get_pet_by_id**](PetApi.md#get_pet_by_id) | **GET** /pet/{petId} | Find pet by ID -[**update_pet**](PetApi.md#update_pet) | **PUT** /pet | Update an existing pet -[**update_pet_with_form**](PetApi.md#update_pet_with_form) | **POST** /pet/{petId} | Updates a pet in the store with form data -[**upload_file**](PetApi.md#upload_file) | **POST** /pet/{petId}/uploadImage | uploads an image -[**upload_file_with_required_file**](PetApi.md#upload_file_with_required_file) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) - - -# **add_pet** -> add_pet(pet) - -Add a new pet to the store - - - -### Example - -* OAuth Authentication (petstore_auth): -```python -import time -import os -import petstore_api -from petstore_api.models.pet import Pet -from petstore_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - -# The client must configure the authentication and authorization parameters -# in accordance with the API server security policy. -# Examples for each auth method are provided below, use the example that -# satisfies your auth use case. - -configuration.access_token = os.environ["ACCESS_TOKEN"] - -# Configure HTTP message signature: http_signature_test -# The HTTP Signature Header mechanism that can be used by a client to -# authenticate the sender of a message and ensure that particular headers -# have not been modified in transit. -# -# You can specify the signing key-id, private key path, signing scheme, -# signing algorithm, list of signed headers and signature max validity. -# The 'key_id' parameter is an opaque string that the API server can use -# to lookup the client and validate the signature. -# The 'private_key_path' parameter should be the path to a file that -# contains a DER or base-64 encoded private key. -# The 'private_key_passphrase' parameter is optional. Set the passphrase -# if the private key is encrypted. -# The 'signed_headers' parameter is used to specify the list of -# HTTP headers included when generating the signature for the message. -# You can specify HTTP headers that you want to protect with a cryptographic -# signature. Note that proxies may add, modify or remove HTTP headers -# for legitimate reasons, so you should only add headers that you know -# will not be modified. For example, if you want to protect the HTTP request -# body, you can specify the Digest header. In that case, the client calculates -# the digest of the HTTP request body and includes the digest in the message -# signature. -# The 'signature_max_validity' parameter is optional. It is configured as a -# duration to express when the signature ceases to be valid. The client calculates -# the expiration date every time it generates the cryptographic signature -# of an HTTP request. The API server may have its own security policy -# that controls the maximum validity of the signature. The client max validity -# must be lower than the server max validity. -# The time on the client and server must be synchronized, otherwise the -# server may reject the client signature. -# -# The client must use a combination of private key, signing scheme, -# signing algorithm and hash algorithm that matches the security policy of -# the API server. -# -# See petstore_api.signing for a list of all supported parameters. -from petstore_api import signing -import datetime - -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2", - signing_info = petstore_api.HttpSigningConfiguration( - key_id = 'my-key-id', - private_key_path = 'private_key.pem', - private_key_passphrase = 'YOUR_PASSPHRASE', - signing_scheme = petstore_api.signing.SCHEME_HS2019, - signing_algorithm = petstore_api.signing.ALGORITHM_ECDSA_MODE_FIPS_186_3, - hash_algorithm = petstore_api.signing.SCHEME_RSA_SHA256, - signed_headers = [ - petstore_api.signing.HEADER_REQUEST_TARGET, - petstore_api.signing.HEADER_CREATED, - petstore_api.signing.HEADER_EXPIRES, - petstore_api.signing.HEADER_HOST, - petstore_api.signing.HEADER_DATE, - petstore_api.signing.HEADER_DIGEST, - 'Content-Type', - 'Content-Length', - 'User-Agent' - ], - signature_max_validity = datetime.timedelta(minutes=5) - ) -) - -# Enter a context with an instance of the API client -async with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.PetApi(api_client) - pet = petstore_api.Pet() # Pet | Pet object that needs to be added to the store - - try: - # Add a new pet to the store - await api_instance.add_pet(pet) - except Exception as e: - print("Exception when calling PetApi->add_pet: %s\n" % e) -``` - - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | - -### Return type - -void (empty response body) - -### Authorization - -[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) - -### HTTP request headers - - - **Content-Type**: application/json, application/xml - - **Accept**: Not defined - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful operation | - | -**405** | Invalid input | - | - -[[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) - -# **delete_pet** -> delete_pet(pet_id, api_key=api_key) - -Deletes a pet - - - -### Example - -* OAuth Authentication (petstore_auth): -```python -import time -import os -import petstore_api -from petstore_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - -# The client must configure the authentication and authorization parameters -# in accordance with the API server security policy. -# Examples for each auth method are provided below, use the example that -# satisfies your auth use case. - -configuration.access_token = os.environ["ACCESS_TOKEN"] - -# Enter a context with an instance of the API client -async with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.PetApi(api_client) - pet_id = 56 # int | Pet id to delete - api_key = 'api_key_example' # str | (optional) - - try: - # Deletes a pet - await api_instance.delete_pet(pet_id, api_key=api_key) - except Exception as e: - print("Exception when calling PetApi->delete_pet: %s\n" % e) -``` - - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **pet_id** | **int**| Pet id to delete | - **api_key** | **str**| | [optional] - -### Return type - -void (empty response body) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful operation | - | -**400** | Invalid pet value | - | - -[[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) - -# **find_pets_by_status** -> List[Pet] find_pets_by_status(status) - -Finds Pets by status - -Multiple status values can be provided with comma separated strings - -### Example - -* OAuth Authentication (petstore_auth): -```python -import time -import os -import petstore_api -from petstore_api.models.pet import Pet -from petstore_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - -# The client must configure the authentication and authorization parameters -# in accordance with the API server security policy. -# Examples for each auth method are provided below, use the example that -# satisfies your auth use case. - -configuration.access_token = os.environ["ACCESS_TOKEN"] - -# Configure HTTP message signature: http_signature_test -# The HTTP Signature Header mechanism that can be used by a client to -# authenticate the sender of a message and ensure that particular headers -# have not been modified in transit. -# -# You can specify the signing key-id, private key path, signing scheme, -# signing algorithm, list of signed headers and signature max validity. -# The 'key_id' parameter is an opaque string that the API server can use -# to lookup the client and validate the signature. -# The 'private_key_path' parameter should be the path to a file that -# contains a DER or base-64 encoded private key. -# The 'private_key_passphrase' parameter is optional. Set the passphrase -# if the private key is encrypted. -# The 'signed_headers' parameter is used to specify the list of -# HTTP headers included when generating the signature for the message. -# You can specify HTTP headers that you want to protect with a cryptographic -# signature. Note that proxies may add, modify or remove HTTP headers -# for legitimate reasons, so you should only add headers that you know -# will not be modified. For example, if you want to protect the HTTP request -# body, you can specify the Digest header. In that case, the client calculates -# the digest of the HTTP request body and includes the digest in the message -# signature. -# The 'signature_max_validity' parameter is optional. It is configured as a -# duration to express when the signature ceases to be valid. The client calculates -# the expiration date every time it generates the cryptographic signature -# of an HTTP request. The API server may have its own security policy -# that controls the maximum validity of the signature. The client max validity -# must be lower than the server max validity. -# The time on the client and server must be synchronized, otherwise the -# server may reject the client signature. -# -# The client must use a combination of private key, signing scheme, -# signing algorithm and hash algorithm that matches the security policy of -# the API server. -# -# See petstore_api.signing for a list of all supported parameters. -from petstore_api import signing -import datetime - -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2", - signing_info = petstore_api.HttpSigningConfiguration( - key_id = 'my-key-id', - private_key_path = 'private_key.pem', - private_key_passphrase = 'YOUR_PASSPHRASE', - signing_scheme = petstore_api.signing.SCHEME_HS2019, - signing_algorithm = petstore_api.signing.ALGORITHM_ECDSA_MODE_FIPS_186_3, - hash_algorithm = petstore_api.signing.SCHEME_RSA_SHA256, - signed_headers = [ - petstore_api.signing.HEADER_REQUEST_TARGET, - petstore_api.signing.HEADER_CREATED, - petstore_api.signing.HEADER_EXPIRES, - petstore_api.signing.HEADER_HOST, - petstore_api.signing.HEADER_DATE, - petstore_api.signing.HEADER_DIGEST, - 'Content-Type', - 'Content-Length', - 'User-Agent' - ], - signature_max_validity = datetime.timedelta(minutes=5) - ) -) - -# Enter a context with an instance of the API client -async with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.PetApi(api_client) - status = ['status_example'] # List[str] | Status values that need to be considered for filter - - try: - # Finds Pets by status - api_response = await api_instance.find_pets_by_status(status) - print("The response of PetApi->find_pets_by_status:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling PetApi->find_pets_by_status: %s\n" % e) -``` - - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **status** | [**List[str]**](str.md)| Status values that need to be considered for filter | - -### Return type - -[**List[Pet]**](Pet.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | successful operation | - | -**400** | Invalid status value | - | - -[[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) - -# **find_pets_by_tags** -> List[Pet] find_pets_by_tags(tags) - -Finds Pets by tags - -Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - -### Example - -* OAuth Authentication (petstore_auth): -```python -import time -import os -import petstore_api -from petstore_api.models.pet import Pet -from petstore_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - -# The client must configure the authentication and authorization parameters -# in accordance with the API server security policy. -# Examples for each auth method are provided below, use the example that -# satisfies your auth use case. - -configuration.access_token = os.environ["ACCESS_TOKEN"] - -# Configure HTTP message signature: http_signature_test -# The HTTP Signature Header mechanism that can be used by a client to -# authenticate the sender of a message and ensure that particular headers -# have not been modified in transit. -# -# You can specify the signing key-id, private key path, signing scheme, -# signing algorithm, list of signed headers and signature max validity. -# The 'key_id' parameter is an opaque string that the API server can use -# to lookup the client and validate the signature. -# The 'private_key_path' parameter should be the path to a file that -# contains a DER or base-64 encoded private key. -# The 'private_key_passphrase' parameter is optional. Set the passphrase -# if the private key is encrypted. -# The 'signed_headers' parameter is used to specify the list of -# HTTP headers included when generating the signature for the message. -# You can specify HTTP headers that you want to protect with a cryptographic -# signature. Note that proxies may add, modify or remove HTTP headers -# for legitimate reasons, so you should only add headers that you know -# will not be modified. For example, if you want to protect the HTTP request -# body, you can specify the Digest header. In that case, the client calculates -# the digest of the HTTP request body and includes the digest in the message -# signature. -# The 'signature_max_validity' parameter is optional. It is configured as a -# duration to express when the signature ceases to be valid. The client calculates -# the expiration date every time it generates the cryptographic signature -# of an HTTP request. The API server may have its own security policy -# that controls the maximum validity of the signature. The client max validity -# must be lower than the server max validity. -# The time on the client and server must be synchronized, otherwise the -# server may reject the client signature. -# -# The client must use a combination of private key, signing scheme, -# signing algorithm and hash algorithm that matches the security policy of -# the API server. -# -# See petstore_api.signing for a list of all supported parameters. -from petstore_api import signing -import datetime - -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2", - signing_info = petstore_api.HttpSigningConfiguration( - key_id = 'my-key-id', - private_key_path = 'private_key.pem', - private_key_passphrase = 'YOUR_PASSPHRASE', - signing_scheme = petstore_api.signing.SCHEME_HS2019, - signing_algorithm = petstore_api.signing.ALGORITHM_ECDSA_MODE_FIPS_186_3, - hash_algorithm = petstore_api.signing.SCHEME_RSA_SHA256, - signed_headers = [ - petstore_api.signing.HEADER_REQUEST_TARGET, - petstore_api.signing.HEADER_CREATED, - petstore_api.signing.HEADER_EXPIRES, - petstore_api.signing.HEADER_HOST, - petstore_api.signing.HEADER_DATE, - petstore_api.signing.HEADER_DIGEST, - 'Content-Type', - 'Content-Length', - 'User-Agent' - ], - signature_max_validity = datetime.timedelta(minutes=5) - ) -) - -# Enter a context with an instance of the API client -async with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.PetApi(api_client) - tags = ['tags_example'] # List[str] | Tags to filter by - - try: - # Finds Pets by tags - api_response = await api_instance.find_pets_by_tags(tags) - print("The response of PetApi->find_pets_by_tags:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling PetApi->find_pets_by_tags: %s\n" % e) -``` - - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **tags** | [**List[str]**](str.md)| Tags to filter by | - -### Return type - -[**List[Pet]**](Pet.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | successful operation | - | -**400** | Invalid tag value | - | - -[[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) - -# **get_pet_by_id** -> Pet get_pet_by_id(pet_id) - -Find pet by ID - -Returns a single pet - -### Example - -* Api Key Authentication (api_key): -```python -import time -import os -import petstore_api -from petstore_api.models.pet import Pet -from petstore_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - -# The client must configure the authentication and authorization parameters -# in accordance with the API server security policy. -# Examples for each auth method are provided below, use the example that -# satisfies your auth use case. - -# Configure API key authorization: api_key -configuration.api_key['api_key'] = os.environ["API_KEY"] - -# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -# configuration.api_key_prefix['api_key'] = 'Bearer' - -# Enter a context with an instance of the API client -async with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.PetApi(api_client) - pet_id = 56 # int | ID of pet to return - - try: - # Find pet by ID - api_response = await api_instance.get_pet_by_id(pet_id) - print("The response of PetApi->get_pet_by_id:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling PetApi->get_pet_by_id: %s\n" % e) -``` - - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **pet_id** | **int**| ID of pet to return | - -### Return type - -[**Pet**](Pet.md) - -### Authorization - -[api_key](../README.md#api_key) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | successful operation | - | -**400** | Invalid ID supplied | - | -**404** | Pet not found | - | - -[[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) - -# **update_pet** -> update_pet(pet) - -Update an existing pet - - - -### Example - -* OAuth Authentication (petstore_auth): -```python -import time -import os -import petstore_api -from petstore_api.models.pet import Pet -from petstore_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - -# The client must configure the authentication and authorization parameters -# in accordance with the API server security policy. -# Examples for each auth method are provided below, use the example that -# satisfies your auth use case. - -configuration.access_token = os.environ["ACCESS_TOKEN"] - -# Configure HTTP message signature: http_signature_test -# The HTTP Signature Header mechanism that can be used by a client to -# authenticate the sender of a message and ensure that particular headers -# have not been modified in transit. -# -# You can specify the signing key-id, private key path, signing scheme, -# signing algorithm, list of signed headers and signature max validity. -# The 'key_id' parameter is an opaque string that the API server can use -# to lookup the client and validate the signature. -# The 'private_key_path' parameter should be the path to a file that -# contains a DER or base-64 encoded private key. -# The 'private_key_passphrase' parameter is optional. Set the passphrase -# if the private key is encrypted. -# The 'signed_headers' parameter is used to specify the list of -# HTTP headers included when generating the signature for the message. -# You can specify HTTP headers that you want to protect with a cryptographic -# signature. Note that proxies may add, modify or remove HTTP headers -# for legitimate reasons, so you should only add headers that you know -# will not be modified. For example, if you want to protect the HTTP request -# body, you can specify the Digest header. In that case, the client calculates -# the digest of the HTTP request body and includes the digest in the message -# signature. -# The 'signature_max_validity' parameter is optional. It is configured as a -# duration to express when the signature ceases to be valid. The client calculates -# the expiration date every time it generates the cryptographic signature -# of an HTTP request. The API server may have its own security policy -# that controls the maximum validity of the signature. The client max validity -# must be lower than the server max validity. -# The time on the client and server must be synchronized, otherwise the -# server may reject the client signature. -# -# The client must use a combination of private key, signing scheme, -# signing algorithm and hash algorithm that matches the security policy of -# the API server. -# -# See petstore_api.signing for a list of all supported parameters. -from petstore_api import signing -import datetime - -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2", - signing_info = petstore_api.HttpSigningConfiguration( - key_id = 'my-key-id', - private_key_path = 'private_key.pem', - private_key_passphrase = 'YOUR_PASSPHRASE', - signing_scheme = petstore_api.signing.SCHEME_HS2019, - signing_algorithm = petstore_api.signing.ALGORITHM_ECDSA_MODE_FIPS_186_3, - hash_algorithm = petstore_api.signing.SCHEME_RSA_SHA256, - signed_headers = [ - petstore_api.signing.HEADER_REQUEST_TARGET, - petstore_api.signing.HEADER_CREATED, - petstore_api.signing.HEADER_EXPIRES, - petstore_api.signing.HEADER_HOST, - petstore_api.signing.HEADER_DATE, - petstore_api.signing.HEADER_DIGEST, - 'Content-Type', - 'Content-Length', - 'User-Agent' - ], - signature_max_validity = datetime.timedelta(minutes=5) - ) -) - -# Enter a context with an instance of the API client -async with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.PetApi(api_client) - pet = petstore_api.Pet() # Pet | Pet object that needs to be added to the store - - try: - # Update an existing pet - await api_instance.update_pet(pet) - except Exception as e: - print("Exception when calling PetApi->update_pet: %s\n" % e) -``` - - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | - -### Return type - -void (empty response body) - -### Authorization - -[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) - -### HTTP request headers - - - **Content-Type**: application/json, application/xml - - **Accept**: Not defined - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful operation | - | -**400** | Invalid ID supplied | - | -**404** | Pet not found | - | -**405** | Validation exception | - | - -[[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) - -# **update_pet_with_form** -> update_pet_with_form(pet_id, name=name, status=status) - -Updates a pet in the store with form data - - - -### Example - -* OAuth Authentication (petstore_auth): -```python -import time -import os -import petstore_api -from petstore_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - -# The client must configure the authentication and authorization parameters -# in accordance with the API server security policy. -# Examples for each auth method are provided below, use the example that -# satisfies your auth use case. - -configuration.access_token = os.environ["ACCESS_TOKEN"] - -# Enter a context with an instance of the API client -async with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.PetApi(api_client) - pet_id = 56 # int | ID of pet that needs to be updated - name = 'name_example' # str | Updated name of the pet (optional) - status = 'status_example' # str | Updated status of the pet (optional) - - try: - # Updates a pet in the store with form data - await api_instance.update_pet_with_form(pet_id, name=name, status=status) - except Exception as e: - print("Exception when calling PetApi->update_pet_with_form: %s\n" % e) -``` - - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **pet_id** | **int**| ID of pet that needs to be updated | - **name** | **str**| Updated name of the pet | [optional] - **status** | **str**| Updated status of the pet | [optional] - -### Return type - -void (empty response body) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: application/x-www-form-urlencoded - - **Accept**: Not defined - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Successful operation | - | -**405** | Invalid input | - | - -[[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) - -# **upload_file** -> ApiResponse upload_file(pet_id, additional_metadata=additional_metadata, file=file) - -uploads an image - - - -### Example - -* OAuth Authentication (petstore_auth): -```python -import time -import os -import petstore_api -from petstore_api.models.api_response import ApiResponse -from petstore_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - -# The client must configure the authentication and authorization parameters -# in accordance with the API server security policy. -# Examples for each auth method are provided below, use the example that -# satisfies your auth use case. - -configuration.access_token = os.environ["ACCESS_TOKEN"] - -# Enter a context with an instance of the API client -async with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.PetApi(api_client) - pet_id = 56 # int | ID of pet to update - additional_metadata = 'additional_metadata_example' # str | Additional data to pass to server (optional) - file = None # bytearray | file to upload (optional) - - try: - # uploads an image - api_response = await api_instance.upload_file(pet_id, additional_metadata=additional_metadata, file=file) - print("The response of PetApi->upload_file:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling PetApi->upload_file: %s\n" % e) -``` - - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **pet_id** | **int**| ID of pet to update | - **additional_metadata** | **str**| Additional data to pass to server | [optional] - **file** | **bytearray**| file to upload | [optional] - -### Return type - -[**ApiResponse**](ApiResponse.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: multipart/form-data - - **Accept**: application/json - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | successful operation | - | - -[[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) - -# **upload_file_with_required_file** -> ApiResponse upload_file_with_required_file(pet_id, required_file, additional_metadata=additional_metadata) - -uploads an image (required) - - - -### Example - -* OAuth Authentication (petstore_auth): -```python -import time -import os -import petstore_api -from petstore_api.models.api_response import ApiResponse -from petstore_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - -# The client must configure the authentication and authorization parameters -# in accordance with the API server security policy. -# Examples for each auth method are provided below, use the example that -# satisfies your auth use case. - -configuration.access_token = os.environ["ACCESS_TOKEN"] - -# Enter a context with an instance of the API client -async with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.PetApi(api_client) - pet_id = 56 # int | ID of pet to update - required_file = None # bytearray | file to upload - additional_metadata = 'additional_metadata_example' # str | Additional data to pass to server (optional) - - try: - # uploads an image (required) - api_response = await api_instance.upload_file_with_required_file(pet_id, required_file, additional_metadata=additional_metadata) - print("The response of PetApi->upload_file_with_required_file:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling PetApi->upload_file_with_required_file: %s\n" % e) -``` - - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **pet_id** | **int**| ID of pet to update | - **required_file** | **bytearray**| file to upload | - **additional_metadata** | **str**| Additional data to pass to server | [optional] - -### Return type - -[**ApiResponse**](ApiResponse.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: multipart/form-data - - **Accept**: application/json - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | successful operation | - | - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Pig.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Pig.md deleted file mode 100644 index 398d6c6c6e38..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Pig.md +++ /dev/null @@ -1,30 +0,0 @@ -# Pig - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**class_name** | **str** | | -**color** | **str** | | -**size** | **int** | | - -## Example - -```python -from petstore_api.models.pig import Pig - -# TODO update the JSON string below -json = "{}" -# create an instance of Pig from a JSON string -pig_instance = Pig.from_json(json) -# print the JSON string representation of the object -print Pig.to_json() - -# convert the object into a dict -pig_dict = pig_instance.to_dict() -# create an instance of Pig from a dict -pig_form_dict = pig.from_dict(pig_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/PropertyNameCollision.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/PropertyNameCollision.md deleted file mode 100644 index 2cc1898be69b..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/PropertyNameCollision.md +++ /dev/null @@ -1,30 +0,0 @@ -# PropertyNameCollision - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**type** | **str** | | [optional] -**type** | **str** | | [optional] -**type_** | **str** | | [optional] - -## Example - -```python -from petstore_api.models.property_name_collision import PropertyNameCollision - -# TODO update the JSON string below -json = "{}" -# create an instance of PropertyNameCollision from a JSON string -property_name_collision_instance = PropertyNameCollision.from_json(json) -# print the JSON string representation of the object -print PropertyNameCollision.to_json() - -# convert the object into a dict -property_name_collision_dict = property_name_collision_instance.to_dict() -# create an instance of PropertyNameCollision from a dict -property_name_collision_form_dict = property_name_collision.from_dict(property_name_collision_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ReadOnlyFirst.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ReadOnlyFirst.md deleted file mode 100644 index 22b5acca70c7..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ReadOnlyFirst.md +++ /dev/null @@ -1,29 +0,0 @@ -# ReadOnlyFirst - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**bar** | **str** | | [optional] [readonly] -**baz** | **str** | | [optional] - -## Example - -```python -from petstore_api.models.read_only_first import ReadOnlyFirst - -# TODO update the JSON string below -json = "{}" -# create an instance of ReadOnlyFirst from a JSON string -read_only_first_instance = ReadOnlyFirst.from_json(json) -# print the JSON string representation of the object -print ReadOnlyFirst.to_json() - -# convert the object into a dict -read_only_first_dict = read_only_first_instance.to_dict() -# create an instance of ReadOnlyFirst from a dict -read_only_first_form_dict = read_only_first.from_dict(read_only_first_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/SecondRef.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/SecondRef.md deleted file mode 100644 index e6fb1e2d4f7c..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/SecondRef.md +++ /dev/null @@ -1,29 +0,0 @@ -# SecondRef - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**category** | **str** | | [optional] -**circular_ref** | [**CircularReferenceModel**](CircularReferenceModel.md) | | [optional] - -## Example - -```python -from petstore_api.models.second_ref import SecondRef - -# TODO update the JSON string below -json = "{}" -# create an instance of SecondRef from a JSON string -second_ref_instance = SecondRef.from_json(json) -# print the JSON string representation of the object -print SecondRef.to_json() - -# convert the object into a dict -second_ref_dict = second_ref_instance.to_dict() -# create an instance of SecondRef from a dict -second_ref_form_dict = second_ref.from_dict(second_ref_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/SelfReferenceModel.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/SelfReferenceModel.md deleted file mode 100644 index dbf9589d576b..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/SelfReferenceModel.md +++ /dev/null @@ -1,29 +0,0 @@ -# SelfReferenceModel - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**size** | **int** | | [optional] -**nested** | [**DummyModel**](DummyModel.md) | | [optional] - -## Example - -```python -from petstore_api.models.self_reference_model import SelfReferenceModel - -# TODO update the JSON string below -json = "{}" -# create an instance of SelfReferenceModel from a JSON string -self_reference_model_instance = SelfReferenceModel.from_json(json) -# print the JSON string representation of the object -print SelfReferenceModel.to_json() - -# convert the object into a dict -self_reference_model_dict = self_reference_model_instance.to_dict() -# create an instance of SelfReferenceModel from a dict -self_reference_model_form_dict = self_reference_model.from_dict(self_reference_model_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/SingleRefType.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/SingleRefType.md deleted file mode 100644 index 4178ac3b505e..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/SingleRefType.md +++ /dev/null @@ -1,10 +0,0 @@ -# SingleRefType - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/SpecialCharacterEnum.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/SpecialCharacterEnum.md deleted file mode 100644 index 801c3b5c8459..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/SpecialCharacterEnum.md +++ /dev/null @@ -1,10 +0,0 @@ -# SpecialCharacterEnum - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/SpecialModelName.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/SpecialModelName.md deleted file mode 100644 index 3d27640abb04..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/SpecialModelName.md +++ /dev/null @@ -1,28 +0,0 @@ -# SpecialModelName - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**special_property_name** | **int** | | [optional] - -## Example - -```python -from petstore_api.models.special_model_name import SpecialModelName - -# TODO update the JSON string below -json = "{}" -# create an instance of SpecialModelName from a JSON string -special_model_name_instance = SpecialModelName.from_json(json) -# print the JSON string representation of the object -print SpecialModelName.to_json() - -# convert the object into a dict -special_model_name_dict = special_model_name_instance.to_dict() -# create an instance of SpecialModelName from a dict -special_model_name_form_dict = special_model_name.from_dict(special_model_name_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/SpecialName.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/SpecialName.md deleted file mode 100644 index 0b4129525978..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/SpecialName.md +++ /dev/null @@ -1,30 +0,0 @@ -# SpecialName - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**var_property** | **int** | | [optional] -**var_async** | [**Category**](Category.md) | | [optional] -**var_schema** | **str** | pet status in the store | [optional] - -## Example - -```python -from petstore_api.models.special_name import SpecialName - -# TODO update the JSON string below -json = "{}" -# create an instance of SpecialName from a JSON string -special_name_instance = SpecialName.from_json(json) -# print the JSON string representation of the object -print SpecialName.to_json() - -# convert the object into a dict -special_name_dict = special_name_instance.to_dict() -# create an instance of SpecialName from a dict -special_name_form_dict = special_name.from_dict(special_name_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/StoreApi.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/StoreApi.md deleted file mode 100644 index 9d7a7b781701..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/StoreApi.md +++ /dev/null @@ -1,287 +0,0 @@ -# petstore_api.StoreApi - -All URIs are relative to *http://petstore.swagger.io:80/v2* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**delete_order**](StoreApi.md#delete_order) | **DELETE** /store/order/{order_id} | Delete purchase order by ID -[**get_inventory**](StoreApi.md#get_inventory) | **GET** /store/inventory | Returns pet inventories by status -[**get_order_by_id**](StoreApi.md#get_order_by_id) | **GET** /store/order/{order_id} | Find purchase order by ID -[**place_order**](StoreApi.md#place_order) | **POST** /store/order | Place an order for a pet - - -# **delete_order** -> delete_order(order_id) - -Delete purchase order by ID - -For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - -### Example - -```python -import time -import os -import petstore_api -from petstore_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - - -# Enter a context with an instance of the API client -async with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.StoreApi(api_client) - order_id = 'order_id_example' # str | ID of the order that needs to be deleted - - try: - # Delete purchase order by ID - await api_instance.delete_order(order_id) - except Exception as e: - print("Exception when calling StoreApi->delete_order: %s\n" % e) -``` - - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **order_id** | **str**| ID of the order that needs to be deleted | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**400** | Invalid ID supplied | - | -**404** | Order not found | - | - -[[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) - -# **get_inventory** -> Dict[str, int] get_inventory() - -Returns pet inventories by status - -Returns a map of status codes to quantities - -### Example - -* Api Key Authentication (api_key): -```python -import time -import os -import petstore_api -from petstore_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - -# The client must configure the authentication and authorization parameters -# in accordance with the API server security policy. -# Examples for each auth method are provided below, use the example that -# satisfies your auth use case. - -# Configure API key authorization: api_key -configuration.api_key['api_key'] = os.environ["API_KEY"] - -# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -# configuration.api_key_prefix['api_key'] = 'Bearer' - -# Enter a context with an instance of the API client -async with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.StoreApi(api_client) - - try: - # Returns pet inventories by status - api_response = await api_instance.get_inventory() - print("The response of StoreApi->get_inventory:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling StoreApi->get_inventory: %s\n" % e) -``` - - - -### Parameters -This endpoint does not need any parameter. - -### Return type - -**Dict[str, int]** - -### Authorization - -[api_key](../README.md#api_key) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | successful operation | - | - -[[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) - -# **get_order_by_id** -> Order get_order_by_id(order_id) - -Find purchase order by ID - -For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - -### Example - -```python -import time -import os -import petstore_api -from petstore_api.models.order import Order -from petstore_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - - -# Enter a context with an instance of the API client -async with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.StoreApi(api_client) - order_id = 56 # int | ID of pet that needs to be fetched - - try: - # Find purchase order by ID - api_response = await api_instance.get_order_by_id(order_id) - print("The response of StoreApi->get_order_by_id:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling StoreApi->get_order_by_id: %s\n" % e) -``` - - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **order_id** | **int**| ID of pet that needs to be fetched | - -### Return type - -[**Order**](Order.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | successful operation | - | -**400** | Invalid ID supplied | - | -**404** | Order not found | - | - -[[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) - -# **place_order** -> Order place_order(order) - -Place an order for a pet - - - -### Example - -```python -import time -import os -import petstore_api -from petstore_api.models.order import Order -from petstore_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - - -# Enter a context with an instance of the API client -async with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.StoreApi(api_client) - order = petstore_api.Order() # Order | order placed for purchasing the pet - - try: - # Place an order for a pet - api_response = await api_instance.place_order(order) - print("The response of StoreApi->place_order:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling StoreApi->place_order: %s\n" % e) -``` - - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **order** | [**Order**](Order.md)| order placed for purchasing the pet | - -### Return type - -[**Order**](Order.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/xml, application/json - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | successful operation | - | -**400** | Invalid Order | - | - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Tag.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Tag.md deleted file mode 100644 index e680c68bedd8..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Tag.md +++ /dev/null @@ -1,29 +0,0 @@ -# Tag - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **int** | | [optional] -**name** | **str** | | [optional] - -## Example - -```python -from petstore_api.models.tag import Tag - -# TODO update the JSON string below -json = "{}" -# create an instance of Tag from a JSON string -tag_instance = Tag.from_json(json) -# print the JSON string representation of the object -print Tag.to_json() - -# convert the object into a dict -tag_dict = tag_instance.to_dict() -# create an instance of Tag from a dict -tag_form_dict = tag.from_dict(tag_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/TestInlineFreeformAdditionalPropertiesRequest.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/TestInlineFreeformAdditionalPropertiesRequest.md deleted file mode 100644 index 7cf86c5244e3..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/TestInlineFreeformAdditionalPropertiesRequest.md +++ /dev/null @@ -1,28 +0,0 @@ -# TestInlineFreeformAdditionalPropertiesRequest - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**some_property** | **str** | | [optional] - -## Example - -```python -from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest - -# TODO update the JSON string below -json = "{}" -# create an instance of TestInlineFreeformAdditionalPropertiesRequest from a JSON string -test_inline_freeform_additional_properties_request_instance = TestInlineFreeformAdditionalPropertiesRequest.from_json(json) -# print the JSON string representation of the object -print TestInlineFreeformAdditionalPropertiesRequest.to_json() - -# convert the object into a dict -test_inline_freeform_additional_properties_request_dict = test_inline_freeform_additional_properties_request_instance.to_dict() -# create an instance of TestInlineFreeformAdditionalPropertiesRequest from a dict -test_inline_freeform_additional_properties_request_form_dict = test_inline_freeform_additional_properties_request.from_dict(test_inline_freeform_additional_properties_request_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Tiger.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Tiger.md deleted file mode 100644 index 6ce50a31f5ae..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Tiger.md +++ /dev/null @@ -1,28 +0,0 @@ -# Tiger - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**skill** | **str** | | [optional] - -## Example - -```python -from petstore_api.models.tiger import Tiger - -# TODO update the JSON string below -json = "{}" -# create an instance of Tiger from a JSON string -tiger_instance = Tiger.from_json(json) -# print the JSON string representation of the object -print Tiger.to_json() - -# convert the object into a dict -tiger_dict = tiger_instance.to_dict() -# create an instance of Tiger from a dict -tiger_form_dict = tiger.from_dict(tiger_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/User.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/User.md deleted file mode 100644 index 6d7c357ea865..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/User.md +++ /dev/null @@ -1,35 +0,0 @@ -# User - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **int** | | [optional] -**username** | **str** | | [optional] -**first_name** | **str** | | [optional] -**last_name** | **str** | | [optional] -**email** | **str** | | [optional] -**password** | **str** | | [optional] -**phone** | **str** | | [optional] -**user_status** | **int** | User Status | [optional] - -## Example - -```python -from petstore_api.models.user import User - -# TODO update the JSON string below -json = "{}" -# create an instance of User from a JSON string -user_instance = User.from_json(json) -# print the JSON string representation of the object -print User.to_json() - -# convert the object into a dict -user_dict = user_instance.to_dict() -# create an instance of User from a dict -user_form_dict = user.from_dict(user_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/UserApi.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/UserApi.md deleted file mode 100644 index 0bd69e33d903..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/UserApi.md +++ /dev/null @@ -1,542 +0,0 @@ -# petstore_api.UserApi - -All URIs are relative to *http://petstore.swagger.io:80/v2* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**create_user**](UserApi.md#create_user) | **POST** /user | Create user -[**create_users_with_array_input**](UserApi.md#create_users_with_array_input) | **POST** /user/createWithArray | Creates list of users with given input array -[**create_users_with_list_input**](UserApi.md#create_users_with_list_input) | **POST** /user/createWithList | Creates list of users with given input array -[**delete_user**](UserApi.md#delete_user) | **DELETE** /user/{username} | Delete user -[**get_user_by_name**](UserApi.md#get_user_by_name) | **GET** /user/{username} | Get user by user name -[**login_user**](UserApi.md#login_user) | **GET** /user/login | Logs user into the system -[**logout_user**](UserApi.md#logout_user) | **GET** /user/logout | Logs out current logged in user session -[**update_user**](UserApi.md#update_user) | **PUT** /user/{username} | Updated user - - -# **create_user** -> create_user(user) - -Create user - -This can only be done by the logged in user. - -### Example - -```python -import time -import os -import petstore_api -from petstore_api.models.user import User -from petstore_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - - -# Enter a context with an instance of the API client -async with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.UserApi(api_client) - user = petstore_api.User() # User | Created user object - - try: - # Create user - await api_instance.create_user(user) - except Exception as e: - print("Exception when calling UserApi->create_user: %s\n" % e) -``` - - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **user** | [**User**](User.md)| Created user object | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: Not defined - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**0** | successful operation | - | - -[[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) - -# **create_users_with_array_input** -> create_users_with_array_input(user) - -Creates list of users with given input array - - - -### Example - -```python -import time -import os -import petstore_api -from petstore_api.models.user import User -from petstore_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - - -# Enter a context with an instance of the API client -async with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.UserApi(api_client) - user = [petstore_api.User()] # List[User] | List of user object - - try: - # Creates list of users with given input array - await api_instance.create_users_with_array_input(user) - except Exception as e: - print("Exception when calling UserApi->create_users_with_array_input: %s\n" % e) -``` - - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **user** | [**List[User]**](User.md)| List of user object | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: Not defined - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**0** | successful operation | - | - -[[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) - -# **create_users_with_list_input** -> create_users_with_list_input(user) - -Creates list of users with given input array - - - -### Example - -```python -import time -import os -import petstore_api -from petstore_api.models.user import User -from petstore_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - - -# Enter a context with an instance of the API client -async with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.UserApi(api_client) - user = [petstore_api.User()] # List[User] | List of user object - - try: - # Creates list of users with given input array - await api_instance.create_users_with_list_input(user) - except Exception as e: - print("Exception when calling UserApi->create_users_with_list_input: %s\n" % e) -``` - - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **user** | [**List[User]**](User.md)| List of user object | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: Not defined - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**0** | successful operation | - | - -[[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) - -# **delete_user** -> delete_user(username) - -Delete user - -This can only be done by the logged in user. - -### Example - -```python -import time -import os -import petstore_api -from petstore_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - - -# Enter a context with an instance of the API client -async with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.UserApi(api_client) - username = 'username_example' # str | The name that needs to be deleted - - try: - # Delete user - await api_instance.delete_user(username) - except Exception as e: - print("Exception when calling UserApi->delete_user: %s\n" % e) -``` - - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **username** | **str**| The name that needs to be deleted | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**400** | Invalid username supplied | - | -**404** | User not found | - | - -[[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) - -# **get_user_by_name** -> User get_user_by_name(username) - -Get user by user name - - - -### Example - -```python -import time -import os -import petstore_api -from petstore_api.models.user import User -from petstore_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - - -# Enter a context with an instance of the API client -async with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.UserApi(api_client) - username = 'username_example' # str | The name that needs to be fetched. Use user1 for testing. - - try: - # Get user by user name - api_response = await api_instance.get_user_by_name(username) - print("The response of UserApi->get_user_by_name:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling UserApi->get_user_by_name: %s\n" % e) -``` - - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **username** | **str**| The name that needs to be fetched. Use user1 for testing. | - -### Return type - -[**User**](User.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | successful operation | - | -**400** | Invalid username supplied | - | -**404** | User not found | - | - -[[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) - -# **login_user** -> str login_user(username, password) - -Logs user into the system - - - -### Example - -```python -import time -import os -import petstore_api -from petstore_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - - -# Enter a context with an instance of the API client -async with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.UserApi(api_client) - username = 'username_example' # str | The user name for login - password = 'password_example' # str | The password for login in clear text - - try: - # Logs user into the system - api_response = await api_instance.login_user(username, password) - print("The response of UserApi->login_user:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling UserApi->login_user: %s\n" % e) -``` - - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **username** | **str**| The user name for login | - **password** | **str**| The password for login in clear text | - -### Return type - -**str** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | successful operation | * X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| -**400** | Invalid username/password supplied | - | - -[[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) - -# **logout_user** -> logout_user() - -Logs out current logged in user session - - - -### Example - -```python -import time -import os -import petstore_api -from petstore_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - - -# Enter a context with an instance of the API client -async with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.UserApi(api_client) - - try: - # Logs out current logged in user session - await api_instance.logout_user() - except Exception as e: - print("Exception when calling UserApi->logout_user: %s\n" % e) -``` - - - -### Parameters -This endpoint does not need any parameter. - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**0** | successful operation | - | - -[[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) - -# **update_user** -> update_user(username, user) - -Updated user - -This can only be done by the logged in user. - -### Example - -```python -import time -import os -import petstore_api -from petstore_api.models.user import User -from petstore_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = petstore_api.Configuration( - host = "http://petstore.swagger.io:80/v2" -) - - -# Enter a context with an instance of the API client -async with petstore_api.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = petstore_api.UserApi(api_client) - username = 'username_example' # str | name that need to be deleted - user = petstore_api.User() # User | Updated user object - - try: - # Updated user - await api_instance.update_user(username, user) - except Exception as e: - print("Exception when calling UserApi->update_user: %s\n" % e) -``` - - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **username** | **str**| name that need to be deleted | - **user** | [**User**](User.md)| Updated user object | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: Not defined - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**400** | Invalid user supplied | - | -**404** | User not found | - | - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/WithNestedOneOf.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/WithNestedOneOf.md deleted file mode 100644 index 247afcab99da..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/WithNestedOneOf.md +++ /dev/null @@ -1,30 +0,0 @@ -# WithNestedOneOf - - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**size** | **int** | | [optional] -**nested_pig** | [**Pig**](Pig.md) | | [optional] -**nested_oneof_enum_string** | [**OneOfEnumString**](OneOfEnumString.md) | | [optional] - -## Example - -```python -from petstore_api.models.with_nested_one_of import WithNestedOneOf - -# TODO update the JSON string below -json = "{}" -# create an instance of WithNestedOneOf from a JSON string -with_nested_one_of_instance = WithNestedOneOf.from_json(json) -# print the JSON string representation of the object -print WithNestedOneOf.to_json() - -# convert the object into a dict -with_nested_one_of_dict = with_nested_one_of_instance.to_dict() -# create an instance of WithNestedOneOf from a dict -with_nested_one_of_form_dict = with_nested_one_of.from_dict(with_nested_one_of_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/git_push.sh b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/git_push.sh deleted file mode 100644 index f53a75d4fabe..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/git_push.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/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-petstore-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" - echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" -fi - -if [ "$git_repo_id" = "" ]; then - git_repo_id="GIT_REPO_ID" - echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" -fi - -if [ "$release_note" = "" ]; then - release_note="Minor update" - echo "[INFO] No command line input provided. Set \$release_note to $release_note" -fi - -# Initialize the local directory as a Git repository -git init - -# Adds the files in the local repository and stages them for commit. -git add . - -# Commits the tracked changes and prepares them to be pushed to a remote repository. -git commit -m "$release_note" - -# Sets the new remote -git_remote=$(git remote) -if [ "$git_remote" = "" ]; then # git remote not defined - - if [ "$GIT_TOKEN" = "" ]; then - echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." - git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git - else - git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git - fi - -fi - -git pull origin master - -# Pushes (Forces) the changes in the local repository up to the remote repository -echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" -git push origin master 2>&1 | grep -v 'To https' diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/__init__.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/__init__.py deleted file mode 100644 index 2023e72fb352..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/__init__.py +++ /dev/null @@ -1,119 +0,0 @@ -# coding: utf-8 - -# flake8: noqa - -""" - 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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -__version__ = "1.0.0" - -# import apis into sdk package -from petstore_api.api.another_fake_api import AnotherFakeApi -from petstore_api.api.default_api import DefaultApi -from petstore_api.api.fake_api import FakeApi -from petstore_api.api.fake_classname_tags123_api import FakeClassnameTags123Api -from petstore_api.api.pet_api import PetApi -from petstore_api.api.store_api import StoreApi -from petstore_api.api.user_api import UserApi - -# import ApiClient -from petstore_api.api_response import ApiResponse -from petstore_api.api_client import ApiClient -from petstore_api.configuration import Configuration -from petstore_api.exceptions import OpenApiException -from petstore_api.exceptions import ApiTypeError -from petstore_api.exceptions import ApiValueError -from petstore_api.exceptions import ApiKeyError -from petstore_api.exceptions import ApiAttributeError -from petstore_api.exceptions import ApiException -from petstore_api.signing import HttpSigningConfiguration - -# import models into sdk package -from petstore_api.models.additional_properties_any_type import AdditionalPropertiesAnyType -from petstore_api.models.additional_properties_class import AdditionalPropertiesClass -from petstore_api.models.additional_properties_object import AdditionalPropertiesObject -from petstore_api.models.additional_properties_with_description_only import AdditionalPropertiesWithDescriptionOnly -from petstore_api.models.all_of_with_single_ref import AllOfWithSingleRef -from petstore_api.models.animal import Animal -from petstore_api.models.any_of_color import AnyOfColor -from petstore_api.models.any_of_pig import AnyOfPig -from petstore_api.models.api_response import ApiResponse -from petstore_api.models.array_of_array_of_model import ArrayOfArrayOfModel -from petstore_api.models.array_of_array_of_number_only import ArrayOfArrayOfNumberOnly -from petstore_api.models.array_of_number_only import ArrayOfNumberOnly -from petstore_api.models.array_test import ArrayTest -from petstore_api.models.basque_pig import BasquePig -from petstore_api.models.capitalization import Capitalization -from petstore_api.models.cat import Cat -from petstore_api.models.category import Category -from petstore_api.models.circular_reference_model import CircularReferenceModel -from petstore_api.models.class_model import ClassModel -from petstore_api.models.client import Client -from petstore_api.models.color import Color -from petstore_api.models.creature import Creature -from petstore_api.models.creature_info import CreatureInfo -from petstore_api.models.danish_pig import DanishPig -from petstore_api.models.deprecated_object import DeprecatedObject -from petstore_api.models.dog import Dog -from petstore_api.models.dummy_model import DummyModel -from petstore_api.models.enum_arrays import EnumArrays -from petstore_api.models.enum_class import EnumClass -from petstore_api.models.enum_string1 import EnumString1 -from petstore_api.models.enum_string2 import EnumString2 -from petstore_api.models.enum_test import EnumTest -from petstore_api.models.file import File -from petstore_api.models.file_schema_test_class import FileSchemaTestClass -from petstore_api.models.first_ref import FirstRef -from petstore_api.models.foo import Foo -from petstore_api.models.foo_get_default_response import FooGetDefaultResponse -from petstore_api.models.format_test import FormatTest -from petstore_api.models.has_only_read_only import HasOnlyReadOnly -from petstore_api.models.health_check_result import HealthCheckResult -from petstore_api.models.inner_dict_with_property import InnerDictWithProperty -from petstore_api.models.int_or_string import IntOrString -from petstore_api.models.list import List -from petstore_api.models.map_of_array_of_model import MapOfArrayOfModel -from petstore_api.models.map_test import MapTest -from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass -from petstore_api.models.model200_response import Model200Response -from petstore_api.models.model_return import ModelReturn -from petstore_api.models.name import Name -from petstore_api.models.nullable_class import NullableClass -from petstore_api.models.nullable_property import NullableProperty -from petstore_api.models.number_only import NumberOnly -from petstore_api.models.object_to_test_additional_properties import ObjectToTestAdditionalProperties -from petstore_api.models.object_with_deprecated_fields import ObjectWithDeprecatedFields -from petstore_api.models.one_of_enum_string import OneOfEnumString -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_enum_default_value import OuterEnumDefaultValue -from petstore_api.models.outer_enum_integer import OuterEnumInteger -from petstore_api.models.outer_enum_integer_default_value import OuterEnumIntegerDefaultValue -from petstore_api.models.outer_object_with_enum_property import OuterObjectWithEnumProperty -from petstore_api.models.parent import Parent -from petstore_api.models.parent_with_optional_dict import ParentWithOptionalDict -from petstore_api.models.pet import Pet -from petstore_api.models.pig import Pig -from petstore_api.models.property_name_collision import PropertyNameCollision -from petstore_api.models.read_only_first import ReadOnlyFirst -from petstore_api.models.second_ref import SecondRef -from petstore_api.models.self_reference_model import SelfReferenceModel -from petstore_api.models.single_ref_type import SingleRefType -from petstore_api.models.special_character_enum import SpecialCharacterEnum -from petstore_api.models.special_model_name import SpecialModelName -from petstore_api.models.special_name import SpecialName -from petstore_api.models.tag import Tag -from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest -from petstore_api.models.tiger import Tiger -from petstore_api.models.user import User -from petstore_api.models.with_nested_one_of import WithNestedOneOf diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/__init__.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/__init__.py deleted file mode 100644 index 7a2616975a2f..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/__init__.py +++ /dev/null @@ -1,11 +0,0 @@ -# flake8: noqa - -# import apis into api package -from petstore_api.api.another_fake_api import AnotherFakeApi -from petstore_api.api.default_api import DefaultApi -from petstore_api.api.fake_api import FakeApi -from petstore_api.api.fake_classname_tags123_api import FakeClassnameTags123Api -from petstore_api.api.pet_api import PetApi -from petstore_api.api.store_api import StoreApi -from petstore_api.api.user_api import UserApi - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/another_fake_api.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/another_fake_api.py deleted file mode 100644 index 1fa3f57bcb28..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/another_fake_api.py +++ /dev/null @@ -1,176 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import re # noqa: F401 -import io -import warnings - -from pydantic import validate_arguments, ValidationError -from typing import overload, Optional, Union, Awaitable - -from typing_extensions import Annotated -from pydantic import Field - -from petstore_api.models.client import Client - -from petstore_api.api_client import ApiClient -from petstore_api.api_response import ApiResponse -from petstore_api.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) - - -class AnotherFakeApi: - """NOTE: This class is auto generated by OpenAPI Generator - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - def __init__(self, api_client=None) -> None: - if api_client is None: - api_client = ApiClient.get_default() - self.api_client = api_client - - @validate_arguments - async def call_123_test_special_tags(self, client : Annotated[Client, Field(..., description="client model")], **kwargs) -> Client: # noqa: E501 - """To test special tags # noqa: E501 - - To test special tags and operation ID starting with number # noqa: E501 - - :param client: client model (required) - :type client: Client - :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: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Client - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - message = "Error! Please call the call_123_test_special_tags_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.call_123_test_special_tags_with_http_info(client, **kwargs) # noqa: E501 - - @validate_arguments - async def call_123_test_special_tags_with_http_info(self, client : Annotated[Client, Field(..., description="client model")], **kwargs) -> ApiResponse: # noqa: E501 - """To test special tags # noqa: E501 - - To test special tags and operation ID starting with number # noqa: E501 - - :param client: client model (required) - :type client: Client - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Client, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'client' - ] - _all_params.extend( - [ - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method call_123_test_special_tags" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get('_headers', {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - if _params['client'] is not None: - _body_params = _params['client'] - - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list - - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = { - '200': "Client", - } - - return await self.api_client.call_api( - '/another-fake/dummy', 'PATCH', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/default_api.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/default_api.py deleted file mode 100644 index d2812fd326f2..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/default_api.py +++ /dev/null @@ -1,155 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import re # noqa: F401 -import io -import warnings - -from pydantic import validate_arguments, ValidationError -from typing import overload, Optional, Union, Awaitable - -from petstore_api.models.foo_get_default_response import FooGetDefaultResponse - -from petstore_api.api_client import ApiClient -from petstore_api.api_response import ApiResponse -from petstore_api.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) - - -class DefaultApi: - """NOTE: This class is auto generated by OpenAPI Generator - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - def __init__(self, api_client=None) -> None: - if api_client is None: - api_client = ApiClient.get_default() - self.api_client = api_client - - @validate_arguments - async def foo_get(self, **kwargs) -> FooGetDefaultResponse: # noqa: E501 - """foo_get # noqa: E501 - - - :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: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: FooGetDefaultResponse - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - message = "Error! Please call the foo_get_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.foo_get_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments - async def foo_get_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 - """foo_get # noqa: E501 - - - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(FooGetDefaultResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - ] - _all_params.extend( - [ - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method foo_get" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get('_headers', {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = { - } - - return await self.api_client.call_api( - '/foo', 'GET', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/fake_api.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/fake_api.py deleted file mode 100644 index 975e70cad808..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/fake_api.py +++ /dev/null @@ -1,3028 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import re # noqa: F401 -import io -import warnings - -from pydantic import validate_arguments, ValidationError -from typing import overload, Optional, Union, Awaitable - -from typing_extensions import Annotated -from datetime import date, datetime - -from pydantic import Field, StrictBool, StrictBytes, StrictInt, StrictStr, conbytes, confloat, conint, conlist, constr, validator - -from typing import Any, Dict, List, Optional, Union - -from petstore_api.models.client import Client -from petstore_api.models.enum_class import EnumClass -from petstore_api.models.file_schema_test_class import FileSchemaTestClass -from petstore_api.models.health_check_result import HealthCheckResult -from petstore_api.models.outer_composite import OuterComposite -from petstore_api.models.outer_object_with_enum_property import OuterObjectWithEnumProperty -from petstore_api.models.pet import Pet -from petstore_api.models.tag import Tag -from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest -from petstore_api.models.user import User - -from petstore_api.api_client import ApiClient -from petstore_api.api_response import ApiResponse -from petstore_api.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) - - -class FakeApi: - """NOTE: This class is auto generated by OpenAPI Generator - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - def __init__(self, api_client=None) -> None: - if api_client is None: - api_client = ApiClient.get_default() - self.api_client = api_client - - @validate_arguments - async def fake_any_type_request_body(self, body : Optional[Dict[str, Any]] = None, **kwargs) -> None: # noqa: E501 - """test any type request body # noqa: E501 - - - :param body: - :type body: object - :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: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - message = "Error! Please call the fake_any_type_request_body_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.fake_any_type_request_body_with_http_info(body, **kwargs) # noqa: E501 - - @validate_arguments - async def fake_any_type_request_body_with_http_info(self, body : Optional[Dict[str, Any]] = None, **kwargs) -> ApiResponse: # noqa: E501 - """test any type request body # noqa: E501 - - - :param body: - :type body: object - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = [ - 'body' - ] - _all_params.extend( - [ - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method fake_any_type_request_body" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get('_headers', {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - if _params['body'] is not None: - _body_params = _params['body'] - - # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list - - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - '/fake/any_type_body', 'POST', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) - - @validate_arguments - async def fake_enum_ref_query_parameter(self, enum_ref : Annotated[Optional[EnumClass], Field(description="enum reference")] = None, **kwargs) -> None: # noqa: E501 - """test enum reference query parameter # noqa: E501 - - - :param enum_ref: enum reference - :type enum_ref: EnumClass - :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: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - message = "Error! Please call the fake_enum_ref_query_parameter_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.fake_enum_ref_query_parameter_with_http_info(enum_ref, **kwargs) # noqa: E501 - - @validate_arguments - async def fake_enum_ref_query_parameter_with_http_info(self, enum_ref : Annotated[Optional[EnumClass], Field(description="enum reference")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """test enum reference query parameter # noqa: E501 - - - :param enum_ref: enum reference - :type enum_ref: EnumClass - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = [ - 'enum_ref' - ] - _all_params.extend( - [ - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method fake_enum_ref_query_parameter" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - if _params.get('enum_ref') is not None: # noqa: E501 - _query_params.append(('enum_ref', _params['enum_ref'].value)) - - # process the header parameters - _header_params = dict(_params.get('_headers', {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - '/fake/enum_ref_query_parameter', 'GET', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) - - @validate_arguments - async def fake_health_get(self, **kwargs) -> HealthCheckResult: # noqa: E501 - """Health check endpoint # noqa: E501 - - - :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: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: HealthCheckResult - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - message = "Error! Please call the fake_health_get_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.fake_health_get_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments - async def fake_health_get_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 - """Health check endpoint # noqa: E501 - - - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(HealthCheckResult, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - ] - _all_params.extend( - [ - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method fake_health_get" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get('_headers', {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = { - '200': "HealthCheckResult", - } - - return await self.api_client.call_api( - '/fake/health', 'GET', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) - - @validate_arguments - async def fake_http_signature_test(self, pet : Annotated[Pet, Field(..., description="Pet object that needs to be added to the store")], query_1 : Annotated[Optional[StrictStr], Field(description="query parameter")] = None, header_1 : Annotated[Optional[StrictStr], Field(description="header parameter")] = None, **kwargs) -> None: # noqa: E501 - """test http signature authentication # noqa: E501 - - - :param pet: Pet object that needs to be added to the store (required) - :type pet: Pet - :param query_1: query parameter - :type query_1: str - :param header_1: header parameter - :type header_1: str - :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: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - message = "Error! Please call the fake_http_signature_test_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.fake_http_signature_test_with_http_info(pet, query_1, header_1, **kwargs) # noqa: E501 - - @validate_arguments - async def fake_http_signature_test_with_http_info(self, pet : Annotated[Pet, Field(..., description="Pet object that needs to be added to the store")], query_1 : Annotated[Optional[StrictStr], Field(description="query parameter")] = None, header_1 : Annotated[Optional[StrictStr], Field(description="header parameter")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """test http signature authentication # noqa: E501 - - - :param pet: Pet object that needs to be added to the store (required) - :type pet: Pet - :param query_1: query parameter - :type query_1: str - :param header_1: header parameter - :type header_1: str - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = [ - 'pet', - 'query_1', - 'header_1' - ] - _all_params.extend( - [ - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method fake_http_signature_test" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - if _params.get('query_1') is not None: # noqa: E501 - _query_params.append(('query_1', _params['query_1'])) - - # process the header parameters - _header_params = dict(_params.get('_headers', {})) - if _params['header_1'] is not None: - _header_params['header_1'] = _params['header_1'] - - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - if _params['pet'] is not None: - _body_params = _params['pet'] - - # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json', 'application/xml'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list - - # authentication setting - _auth_settings = ['http_signature_test'] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - '/fake/http-signature-test', 'GET', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) - - @validate_arguments - async def fake_outer_boolean_serialize(self, body : Annotated[Optional[StrictBool], Field(description="Input boolean as post body")] = None, **kwargs) -> bool: # noqa: E501 - """fake_outer_boolean_serialize # noqa: E501 - - Test serialization of outer boolean types # noqa: E501 - - :param body: Input boolean as post body - :type body: bool - :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: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: bool - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - message = "Error! Please call the fake_outer_boolean_serialize_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.fake_outer_boolean_serialize_with_http_info(body, **kwargs) # noqa: E501 - - @validate_arguments - async def fake_outer_boolean_serialize_with_http_info(self, body : Annotated[Optional[StrictBool], Field(description="Input boolean as post body")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """fake_outer_boolean_serialize # noqa: E501 - - Test serialization of outer boolean types # noqa: E501 - - :param body: Input boolean as post body - :type body: bool - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(bool, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'body' - ] - _all_params.extend( - [ - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method fake_outer_boolean_serialize" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get('_headers', {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - if _params['body'] is not None: - _body_params = _params['body'] - - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - ['*/*']) # noqa: E501 - - # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list - - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = { - '200': "bool", - } - - return await self.api_client.call_api( - '/fake/outer/boolean', 'POST', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) - - @validate_arguments - async def fake_outer_composite_serialize(self, outer_composite : Annotated[Optional[OuterComposite], Field(description="Input composite as post body")] = None, **kwargs) -> OuterComposite: # noqa: E501 - """fake_outer_composite_serialize # noqa: E501 - - Test serialization of object with outer number type # noqa: E501 - - :param outer_composite: Input composite as post body - :type outer_composite: OuterComposite - :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: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: OuterComposite - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - message = "Error! Please call the fake_outer_composite_serialize_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.fake_outer_composite_serialize_with_http_info(outer_composite, **kwargs) # noqa: E501 - - @validate_arguments - async def fake_outer_composite_serialize_with_http_info(self, outer_composite : Annotated[Optional[OuterComposite], Field(description="Input composite as post body")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """fake_outer_composite_serialize # noqa: E501 - - Test serialization of object with outer number type # noqa: E501 - - :param outer_composite: Input composite as post body - :type outer_composite: OuterComposite - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(OuterComposite, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'outer_composite' - ] - _all_params.extend( - [ - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method fake_outer_composite_serialize" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get('_headers', {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - if _params['outer_composite'] is not None: - _body_params = _params['outer_composite'] - - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - ['*/*']) # noqa: E501 - - # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list - - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = { - '200': "OuterComposite", - } - - return await self.api_client.call_api( - '/fake/outer/composite', 'POST', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) - - @validate_arguments - async def fake_outer_number_serialize(self, body : Annotated[Optional[float], Field(description="Input number as post body")] = None, **kwargs) -> float: # noqa: E501 - """fake_outer_number_serialize # noqa: E501 - - Test serialization of outer number types # noqa: E501 - - :param body: Input number as post body - :type body: float - :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: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: float - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - message = "Error! Please call the fake_outer_number_serialize_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.fake_outer_number_serialize_with_http_info(body, **kwargs) # noqa: E501 - - @validate_arguments - async def fake_outer_number_serialize_with_http_info(self, body : Annotated[Optional[float], Field(description="Input number as post body")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """fake_outer_number_serialize # noqa: E501 - - Test serialization of outer number types # noqa: E501 - - :param body: Input number as post body - :type body: float - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(float, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'body' - ] - _all_params.extend( - [ - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method fake_outer_number_serialize" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get('_headers', {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - if _params['body'] is not None: - _body_params = _params['body'] - - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - ['*/*']) # noqa: E501 - - # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list - - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = { - '200': "float", - } - - return await self.api_client.call_api( - '/fake/outer/number', 'POST', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) - - @validate_arguments - async def fake_outer_string_serialize(self, body : Annotated[Optional[StrictStr], Field(description="Input string as post body")] = None, **kwargs) -> str: # noqa: E501 - """fake_outer_string_serialize # noqa: E501 - - Test serialization of outer string types # noqa: E501 - - :param body: Input string as post body - :type body: str - :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: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: str - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - message = "Error! Please call the fake_outer_string_serialize_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.fake_outer_string_serialize_with_http_info(body, **kwargs) # noqa: E501 - - @validate_arguments - async def fake_outer_string_serialize_with_http_info(self, body : Annotated[Optional[StrictStr], Field(description="Input string as post body")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """fake_outer_string_serialize # noqa: E501 - - Test serialization of outer string types # noqa: E501 - - :param body: Input string as post body - :type body: str - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(str, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'body' - ] - _all_params.extend( - [ - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method fake_outer_string_serialize" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get('_headers', {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - if _params['body'] is not None: - _body_params = _params['body'] - - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - ['*/*']) # noqa: E501 - - # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list - - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = { - '200': "str", - } - - return await self.api_client.call_api( - '/fake/outer/string', 'POST', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) - - @validate_arguments - async def fake_property_enum_integer_serialize(self, outer_object_with_enum_property : Annotated[OuterObjectWithEnumProperty, Field(..., description="Input enum (int) as post body")], **kwargs) -> OuterObjectWithEnumProperty: # noqa: E501 - """fake_property_enum_integer_serialize # noqa: E501 - - Test serialization of enum (int) properties with examples # noqa: E501 - - :param outer_object_with_enum_property: Input enum (int) as post body (required) - :type outer_object_with_enum_property: OuterObjectWithEnumProperty - :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: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: OuterObjectWithEnumProperty - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - message = "Error! Please call the fake_property_enum_integer_serialize_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.fake_property_enum_integer_serialize_with_http_info(outer_object_with_enum_property, **kwargs) # noqa: E501 - - @validate_arguments - async def fake_property_enum_integer_serialize_with_http_info(self, outer_object_with_enum_property : Annotated[OuterObjectWithEnumProperty, Field(..., description="Input enum (int) as post body")], **kwargs) -> ApiResponse: # noqa: E501 - """fake_property_enum_integer_serialize # noqa: E501 - - Test serialization of enum (int) properties with examples # noqa: E501 - - :param outer_object_with_enum_property: Input enum (int) as post body (required) - :type outer_object_with_enum_property: OuterObjectWithEnumProperty - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(OuterObjectWithEnumProperty, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'outer_object_with_enum_property' - ] - _all_params.extend( - [ - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method fake_property_enum_integer_serialize" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get('_headers', {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - if _params['outer_object_with_enum_property'] is not None: - _body_params = _params['outer_object_with_enum_property'] - - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - ['*/*']) # noqa: E501 - - # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list - - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = { - '200': "OuterObjectWithEnumProperty", - } - - return await self.api_client.call_api( - '/fake/property/enum-int', 'POST', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) - - @validate_arguments - async def fake_return_list_of_objects(self, **kwargs) -> List[List[Tag]]: # noqa: E501 - """test returning list of objects # noqa: E501 - - - :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: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: List[List[Tag]] - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - message = "Error! Please call the fake_return_list_of_objects_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.fake_return_list_of_objects_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments - async def fake_return_list_of_objects_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 - """test returning list of objects # noqa: E501 - - - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(List[List[Tag]], status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - ] - _all_params.extend( - [ - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method fake_return_list_of_objects" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get('_headers', {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = { - '200': "List[List[Tag]]", - } - - return await self.api_client.call_api( - '/fake/return_list_of_object', 'GET', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) - - @validate_arguments - async def fake_uuid_example(self, uuid_example : Annotated[StrictStr, Field(..., description="uuid example")], **kwargs) -> None: # noqa: E501 - """test uuid example # noqa: E501 - - - :param uuid_example: uuid example (required) - :type uuid_example: str - :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: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - message = "Error! Please call the fake_uuid_example_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.fake_uuid_example_with_http_info(uuid_example, **kwargs) # noqa: E501 - - @validate_arguments - async def fake_uuid_example_with_http_info(self, uuid_example : Annotated[StrictStr, Field(..., description="uuid example")], **kwargs) -> ApiResponse: # noqa: E501 - """test uuid example # noqa: E501 - - - :param uuid_example: uuid example (required) - :type uuid_example: str - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = [ - 'uuid_example' - ] - _all_params.extend( - [ - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method fake_uuid_example" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - if _params.get('uuid_example') is not None: # noqa: E501 - _query_params.append(('uuid_example', _params['uuid_example'])) - - # process the header parameters - _header_params = dict(_params.get('_headers', {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - '/fake/uuid_example', 'GET', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) - - @validate_arguments - async def test_body_with_binary(self, body : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(..., description="image to upload")], **kwargs) -> None: # noqa: E501 - """test_body_with_binary # noqa: E501 - - For this test, the body has to be a binary file. # noqa: E501 - - :param body: image to upload (required) - :type body: bytearray - :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: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - message = "Error! Please call the test_body_with_binary_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.test_body_with_binary_with_http_info(body, **kwargs) # noqa: E501 - - @validate_arguments - async def test_body_with_binary_with_http_info(self, body : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(..., description="image to upload")], **kwargs) -> ApiResponse: # noqa: E501 - """test_body_with_binary # noqa: E501 - - For this test, the body has to be a binary file. # noqa: E501 - - :param body: image to upload (required) - :type body: bytearray - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = [ - 'body' - ] - _all_params.extend( - [ - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method test_body_with_binary" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get('_headers', {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - if _params['body'] is not None: - _body_params = _params['body'] - # convert to byte array if the input is a file name (str) - if isinstance(_body_params, str): - with io.open(_body_params, "rb") as _fp: - _body_params_from_file = _fp.read() - _body_params = _body_params_from_file - - # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['image/png'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list - - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - '/fake/body-with-binary', 'PUT', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) - - @validate_arguments - async def test_body_with_file_schema(self, file_schema_test_class : FileSchemaTestClass, **kwargs) -> None: # noqa: E501 - """test_body_with_file_schema # noqa: E501 - - For this test, the body for this request must reference a schema named `File`. # noqa: E501 - - :param file_schema_test_class: (required) - :type file_schema_test_class: FileSchemaTestClass - :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: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - message = "Error! Please call the test_body_with_file_schema_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.test_body_with_file_schema_with_http_info(file_schema_test_class, **kwargs) # noqa: E501 - - @validate_arguments - async def test_body_with_file_schema_with_http_info(self, file_schema_test_class : FileSchemaTestClass, **kwargs) -> ApiResponse: # noqa: E501 - """test_body_with_file_schema # noqa: E501 - - For this test, the body for this request must reference a schema named `File`. # noqa: E501 - - :param file_schema_test_class: (required) - :type file_schema_test_class: FileSchemaTestClass - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = [ - 'file_schema_test_class' - ] - _all_params.extend( - [ - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method test_body_with_file_schema" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get('_headers', {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - if _params['file_schema_test_class'] is not None: - _body_params = _params['file_schema_test_class'] - - # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list - - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - '/fake/body-with-file-schema', 'PUT', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) - - @validate_arguments - async def test_body_with_query_params(self, query : StrictStr, user : User, **kwargs) -> None: # noqa: E501 - """test_body_with_query_params # noqa: E501 - - - :param query: (required) - :type query: str - :param user: (required) - :type user: User - :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: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - message = "Error! Please call the test_body_with_query_params_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.test_body_with_query_params_with_http_info(query, user, **kwargs) # noqa: E501 - - @validate_arguments - async def test_body_with_query_params_with_http_info(self, query : StrictStr, user : User, **kwargs) -> ApiResponse: # noqa: E501 - """test_body_with_query_params # noqa: E501 - - - :param query: (required) - :type query: str - :param user: (required) - :type user: User - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = [ - 'query', - 'user' - ] - _all_params.extend( - [ - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method test_body_with_query_params" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - if _params.get('query') is not None: # noqa: E501 - _query_params.append(('query', _params['query'])) - - # process the header parameters - _header_params = dict(_params.get('_headers', {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - if _params['user'] is not None: - _body_params = _params['user'] - - # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list - - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - '/fake/body-with-query-params', 'PUT', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) - - @validate_arguments - async def test_client_model(self, client : Annotated[Client, Field(..., description="client model")], **kwargs) -> Client: # noqa: E501 - """To test \"client\" model # noqa: E501 - - To test \"client\" model # noqa: E501 - - :param client: client model (required) - :type client: Client - :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: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Client - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - message = "Error! Please call the test_client_model_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.test_client_model_with_http_info(client, **kwargs) # noqa: E501 - - @validate_arguments - async def test_client_model_with_http_info(self, client : Annotated[Client, Field(..., description="client model")], **kwargs) -> ApiResponse: # noqa: E501 - """To test \"client\" model # noqa: E501 - - To test \"client\" model # noqa: E501 - - :param client: client model (required) - :type client: Client - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Client, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'client' - ] - _all_params.extend( - [ - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method test_client_model" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get('_headers', {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - if _params['client'] is not None: - _body_params = _params['client'] - - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list - - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = { - '200': "Client", - } - - return await self.api_client.call_api( - '/fake', 'PATCH', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) - - @validate_arguments - async def test_date_time_query_parameter(self, date_time_query : datetime, str_query : StrictStr, **kwargs) -> None: # noqa: E501 - """test_date_time_query_parameter # noqa: E501 - - - :param date_time_query: (required) - :type date_time_query: datetime - :param str_query: (required) - :type str_query: str - :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: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - message = "Error! Please call the test_date_time_query_parameter_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.test_date_time_query_parameter_with_http_info(date_time_query, str_query, **kwargs) # noqa: E501 - - @validate_arguments - async def test_date_time_query_parameter_with_http_info(self, date_time_query : datetime, str_query : StrictStr, **kwargs) -> ApiResponse: # noqa: E501 - """test_date_time_query_parameter # noqa: E501 - - - :param date_time_query: (required) - :type date_time_query: datetime - :param str_query: (required) - :type str_query: str - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = [ - 'date_time_query', - 'str_query' - ] - _all_params.extend( - [ - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method test_date_time_query_parameter" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - if _params.get('date_time_query') is not None: # noqa: E501 - if isinstance(_params['date_time_query'], datetime): - _query_params.append(('date_time_query', _params['date_time_query'].strftime(self.api_client.configuration.datetime_format))) - else: - _query_params.append(('date_time_query', _params['date_time_query'])) - - if _params.get('str_query') is not None: # noqa: E501 - _query_params.append(('str_query', _params['str_query'])) - - # process the header parameters - _header_params = dict(_params.get('_headers', {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - '/fake/date-time-query-params', 'PUT', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) - - @validate_arguments - async def test_endpoint_parameters(self, number : Annotated[confloat(le=543.2, ge=32.1), Field(..., description="None")], double : Annotated[confloat(le=123.4, ge=67.8), Field(..., description="None")], pattern_without_delimiter : Annotated[constr(strict=True), Field(..., description="None")], byte : Annotated[Union[StrictBytes, StrictStr], Field(..., description="None")], integer : Annotated[Optional[conint(strict=True, le=100, ge=10)], Field(description="None")] = None, int32 : Annotated[Optional[conint(strict=True, le=200, ge=20)], Field(description="None")] = None, int64 : Annotated[Optional[StrictInt], Field(description="None")] = None, float : Annotated[Optional[confloat(le=987.6)], Field(description="None")] = None, string : Annotated[Optional[constr(strict=True)], Field(description="None")] = None, binary : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="None")] = None, byte_with_max_length : Annotated[Optional[Union[conbytes(strict=True, max_length=64), constr(strict=True, max_length=64)]], Field(description="None")] = None, var_date : Annotated[Optional[date], Field(description="None")] = None, date_time : Annotated[Optional[datetime], Field(description="None")] = None, password : Annotated[Optional[constr(strict=True, max_length=64, min_length=10)], Field(description="None")] = None, param_callback : Annotated[Optional[StrictStr], Field(description="None")] = None, **kwargs) -> None: # noqa: E501 - """Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501 - - Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501 - - :param number: None (required) - :type number: float - :param double: None (required) - :type double: float - :param pattern_without_delimiter: None (required) - :type pattern_without_delimiter: str - :param byte: None (required) - :type byte: bytearray - :param integer: None - :type integer: int - :param int32: None - :type int32: int - :param int64: None - :type int64: int - :param float: None - :type float: float - :param string: None - :type string: str - :param binary: None - :type binary: bytearray - :param byte_with_max_length: None - :type byte_with_max_length: bytearray - :param var_date: None - :type var_date: date - :param date_time: None - :type date_time: datetime - :param password: None - :type password: str - :param param_callback: None - :type param_callback: str - :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: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - message = "Error! Please call the test_endpoint_parameters_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.test_endpoint_parameters_with_http_info(number, double, pattern_without_delimiter, byte, integer, int32, int64, float, string, binary, byte_with_max_length, var_date, date_time, password, param_callback, **kwargs) # noqa: E501 - - @validate_arguments - async def test_endpoint_parameters_with_http_info(self, number : Annotated[confloat(le=543.2, ge=32.1), Field(..., description="None")], double : Annotated[confloat(le=123.4, ge=67.8), Field(..., description="None")], pattern_without_delimiter : Annotated[constr(strict=True), Field(..., description="None")], byte : Annotated[Union[StrictBytes, StrictStr], Field(..., description="None")], integer : Annotated[Optional[conint(strict=True, le=100, ge=10)], Field(description="None")] = None, int32 : Annotated[Optional[conint(strict=True, le=200, ge=20)], Field(description="None")] = None, int64 : Annotated[Optional[StrictInt], Field(description="None")] = None, float : Annotated[Optional[confloat(le=987.6)], Field(description="None")] = None, string : Annotated[Optional[constr(strict=True)], Field(description="None")] = None, binary : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="None")] = None, byte_with_max_length : Annotated[Optional[Union[conbytes(strict=True, max_length=64), constr(strict=True, max_length=64)]], Field(description="None")] = None, var_date : Annotated[Optional[date], Field(description="None")] = None, date_time : Annotated[Optional[datetime], Field(description="None")] = None, password : Annotated[Optional[constr(strict=True, max_length=64, min_length=10)], Field(description="None")] = None, param_callback : Annotated[Optional[StrictStr], Field(description="None")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501 - - Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501 - - :param number: None (required) - :type number: float - :param double: None (required) - :type double: float - :param pattern_without_delimiter: None (required) - :type pattern_without_delimiter: str - :param byte: None (required) - :type byte: bytearray - :param integer: None - :type integer: int - :param int32: None - :type int32: int - :param int64: None - :type int64: int - :param float: None - :type float: float - :param string: None - :type string: str - :param binary: None - :type binary: bytearray - :param byte_with_max_length: None - :type byte_with_max_length: bytearray - :param var_date: None - :type var_date: date - :param date_time: None - :type date_time: datetime - :param password: None - :type password: str - :param param_callback: None - :type param_callback: str - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = [ - 'number', - 'double', - 'pattern_without_delimiter', - 'byte', - 'integer', - 'int32', - 'int64', - 'float', - 'string', - 'binary', - 'byte_with_max_length', - 'var_date', - 'date_time', - 'password', - 'param_callback' - ] - _all_params.extend( - [ - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method test_endpoint_parameters" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get('_headers', {})) - # process the form parameters - _form_params = [] - _files = {} - if _params['integer'] is not None: - _form_params.append(('integer', _params['integer'])) - - if _params['int32'] is not None: - _form_params.append(('int32', _params['int32'])) - - if _params['int64'] is not None: - _form_params.append(('int64', _params['int64'])) - - if _params['number'] is not None: - _form_params.append(('number', _params['number'])) - - if _params['float'] is not None: - _form_params.append(('float', _params['float'])) - - if _params['double'] is not None: - _form_params.append(('double', _params['double'])) - - if _params['string'] is not None: - _form_params.append(('string', _params['string'])) - - if _params['pattern_without_delimiter'] is not None: - _form_params.append(('pattern_without_delimiter', _params['pattern_without_delimiter'])) - - if _params['byte'] is not None: - _form_params.append(('byte', _params['byte'])) - - if _params['binary'] is not None: - _files['binary'] = _params['binary'] - - if _params['byte_with_max_length'] is not None: - _form_params.append(('byte_with_max_length', _params['byte_with_max_length'])) - - if _params['var_date'] is not None: - _form_params.append(('date', _params['var_date'])) - - if _params['date_time'] is not None: - _form_params.append(('dateTime', _params['date_time'])) - - if _params['password'] is not None: - _form_params.append(('password', _params['password'])) - - if _params['param_callback'] is not None: - _form_params.append(('callback', _params['param_callback'])) - - # process the body parameter - _body_params = None - # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/x-www-form-urlencoded'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list - - # authentication setting - _auth_settings = ['http_basic_test'] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - '/fake', 'POST', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) - - @validate_arguments - async def test_group_parameters(self, required_string_group : Annotated[StrictInt, Field(..., description="Required String in group parameters")], required_boolean_group : Annotated[StrictBool, Field(..., description="Required Boolean in group parameters")], required_int64_group : Annotated[StrictInt, Field(..., description="Required Integer in group parameters")], string_group : Annotated[Optional[StrictInt], Field(description="String in group parameters")] = None, boolean_group : Annotated[Optional[StrictBool], Field(description="Boolean in group parameters")] = None, int64_group : Annotated[Optional[StrictInt], Field(description="Integer in group parameters")] = None, **kwargs) -> None: # noqa: E501 - """Fake endpoint to test group parameters (optional) # noqa: E501 - - Fake endpoint to test group parameters (optional) # noqa: E501 - - :param required_string_group: Required String in group parameters (required) - :type required_string_group: int - :param required_boolean_group: Required Boolean in group parameters (required) - :type required_boolean_group: bool - :param required_int64_group: Required Integer in group parameters (required) - :type required_int64_group: int - :param string_group: String in group parameters - :type string_group: int - :param boolean_group: Boolean in group parameters - :type boolean_group: bool - :param int64_group: Integer in group parameters - :type int64_group: int - :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: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - message = "Error! Please call the test_group_parameters_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.test_group_parameters_with_http_info(required_string_group, required_boolean_group, required_int64_group, string_group, boolean_group, int64_group, **kwargs) # noqa: E501 - - @validate_arguments - async def test_group_parameters_with_http_info(self, required_string_group : Annotated[StrictInt, Field(..., description="Required String in group parameters")], required_boolean_group : Annotated[StrictBool, Field(..., description="Required Boolean in group parameters")], required_int64_group : Annotated[StrictInt, Field(..., description="Required Integer in group parameters")], string_group : Annotated[Optional[StrictInt], Field(description="String in group parameters")] = None, boolean_group : Annotated[Optional[StrictBool], Field(description="Boolean in group parameters")] = None, int64_group : Annotated[Optional[StrictInt], Field(description="Integer in group parameters")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Fake endpoint to test group parameters (optional) # noqa: E501 - - Fake endpoint to test group parameters (optional) # noqa: E501 - - :param required_string_group: Required String in group parameters (required) - :type required_string_group: int - :param required_boolean_group: Required Boolean in group parameters (required) - :type required_boolean_group: bool - :param required_int64_group: Required Integer in group parameters (required) - :type required_int64_group: int - :param string_group: String in group parameters - :type string_group: int - :param boolean_group: Boolean in group parameters - :type boolean_group: bool - :param int64_group: Integer in group parameters - :type int64_group: int - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = [ - 'required_string_group', - 'required_boolean_group', - 'required_int64_group', - 'string_group', - 'boolean_group', - 'int64_group' - ] - _all_params.extend( - [ - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method test_group_parameters" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - if _params.get('required_string_group') is not None: # noqa: E501 - _query_params.append(('required_string_group', _params['required_string_group'])) - - if _params.get('required_int64_group') is not None: # noqa: E501 - _query_params.append(('required_int64_group', _params['required_int64_group'])) - - if _params.get('string_group') is not None: # noqa: E501 - _query_params.append(('string_group', _params['string_group'])) - - if _params.get('int64_group') is not None: # noqa: E501 - _query_params.append(('int64_group', _params['int64_group'])) - - # process the header parameters - _header_params = dict(_params.get('_headers', {})) - if _params['required_boolean_group'] is not None: - _header_params['required_boolean_group'] = _params['required_boolean_group'] - - if _params['boolean_group'] is not None: - _header_params['boolean_group'] = _params['boolean_group'] - - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # authentication setting - _auth_settings = ['bearer_test'] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - '/fake', 'DELETE', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) - - @validate_arguments - async def test_inline_additional_properties(self, request_body : Annotated[Dict[str, StrictStr], Field(..., description="request body")], **kwargs) -> None: # noqa: E501 - """test inline additionalProperties # noqa: E501 - - # noqa: E501 - - :param request_body: request body (required) - :type request_body: Dict[str, str] - :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: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - message = "Error! Please call the test_inline_additional_properties_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.test_inline_additional_properties_with_http_info(request_body, **kwargs) # noqa: E501 - - @validate_arguments - async def test_inline_additional_properties_with_http_info(self, request_body : Annotated[Dict[str, StrictStr], Field(..., description="request body")], **kwargs) -> ApiResponse: # noqa: E501 - """test inline additionalProperties # noqa: E501 - - # noqa: E501 - - :param request_body: request body (required) - :type request_body: Dict[str, str] - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = [ - 'request_body' - ] - _all_params.extend( - [ - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method test_inline_additional_properties" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get('_headers', {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - if _params['request_body'] is not None: - _body_params = _params['request_body'] - - # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list - - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - '/fake/inline-additionalProperties', 'POST', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) - - @validate_arguments - async def test_inline_freeform_additional_properties(self, test_inline_freeform_additional_properties_request : Annotated[TestInlineFreeformAdditionalPropertiesRequest, Field(..., description="request body")], **kwargs) -> None: # noqa: E501 - """test inline free-form additionalProperties # noqa: E501 - - # noqa: E501 - - :param test_inline_freeform_additional_properties_request: request body (required) - :type test_inline_freeform_additional_properties_request: TestInlineFreeformAdditionalPropertiesRequest - :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: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - message = "Error! Please call the test_inline_freeform_additional_properties_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.test_inline_freeform_additional_properties_with_http_info(test_inline_freeform_additional_properties_request, **kwargs) # noqa: E501 - - @validate_arguments - async def test_inline_freeform_additional_properties_with_http_info(self, test_inline_freeform_additional_properties_request : Annotated[TestInlineFreeformAdditionalPropertiesRequest, Field(..., description="request body")], **kwargs) -> ApiResponse: # noqa: E501 - """test inline free-form additionalProperties # noqa: E501 - - # noqa: E501 - - :param test_inline_freeform_additional_properties_request: request body (required) - :type test_inline_freeform_additional_properties_request: TestInlineFreeformAdditionalPropertiesRequest - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = [ - 'test_inline_freeform_additional_properties_request' - ] - _all_params.extend( - [ - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method test_inline_freeform_additional_properties" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get('_headers', {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - if _params['test_inline_freeform_additional_properties_request'] is not None: - _body_params = _params['test_inline_freeform_additional_properties_request'] - - # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list - - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - '/fake/inline-freeform-additionalProperties', 'POST', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) - - @validate_arguments - async def test_json_form_data(self, param : Annotated[StrictStr, Field(..., description="field1")], param2 : Annotated[StrictStr, Field(..., description="field2")], **kwargs) -> None: # noqa: E501 - """test json serialization of form data # noqa: E501 - - # noqa: E501 - - :param param: field1 (required) - :type param: str - :param param2: field2 (required) - :type param2: str - :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: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - message = "Error! Please call the test_json_form_data_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.test_json_form_data_with_http_info(param, param2, **kwargs) # noqa: E501 - - @validate_arguments - async def test_json_form_data_with_http_info(self, param : Annotated[StrictStr, Field(..., description="field1")], param2 : Annotated[StrictStr, Field(..., description="field2")], **kwargs) -> ApiResponse: # noqa: E501 - """test json serialization of form data # noqa: E501 - - # noqa: E501 - - :param param: field1 (required) - :type param: str - :param param2: field2 (required) - :type param2: str - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = [ - 'param', - 'param2' - ] - _all_params.extend( - [ - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method test_json_form_data" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get('_headers', {})) - # process the form parameters - _form_params = [] - _files = {} - if _params['param'] is not None: - _form_params.append(('param', _params['param'])) - - if _params['param2'] is not None: - _form_params.append(('param2', _params['param2'])) - - # process the body parameter - _body_params = None - # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/x-www-form-urlencoded'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list - - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - '/fake/jsonFormData', 'GET', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) - - @validate_arguments - async def test_query_parameter_collection_format(self, pipe : conlist(StrictStr), ioutil : conlist(StrictStr), http : conlist(StrictStr), url : conlist(StrictStr), context : conlist(StrictStr), allow_empty : StrictStr, language : Optional[Dict[str, StrictStr]] = None, **kwargs) -> None: # noqa: E501 - """test_query_parameter_collection_format # noqa: E501 - - To test the collection format in query parameters # noqa: E501 - - :param pipe: (required) - :type pipe: List[str] - :param ioutil: (required) - :type ioutil: List[str] - :param http: (required) - :type http: List[str] - :param url: (required) - :type url: List[str] - :param context: (required) - :type context: List[str] - :param allow_empty: (required) - :type allow_empty: str - :param language: - :type language: Dict[str, str] - :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: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - message = "Error! Please call the test_query_parameter_collection_format_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.test_query_parameter_collection_format_with_http_info(pipe, ioutil, http, url, context, allow_empty, language, **kwargs) # noqa: E501 - - @validate_arguments - async def test_query_parameter_collection_format_with_http_info(self, pipe : conlist(StrictStr), ioutil : conlist(StrictStr), http : conlist(StrictStr), url : conlist(StrictStr), context : conlist(StrictStr), allow_empty : StrictStr, language : Optional[Dict[str, StrictStr]] = None, **kwargs) -> ApiResponse: # noqa: E501 - """test_query_parameter_collection_format # noqa: E501 - - To test the collection format in query parameters # noqa: E501 - - :param pipe: (required) - :type pipe: List[str] - :param ioutil: (required) - :type ioutil: List[str] - :param http: (required) - :type http: List[str] - :param url: (required) - :type url: List[str] - :param context: (required) - :type context: List[str] - :param allow_empty: (required) - :type allow_empty: str - :param language: - :type language: Dict[str, str] - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = [ - 'pipe', - 'ioutil', - 'http', - 'url', - 'context', - 'allow_empty', - 'language' - ] - _all_params.extend( - [ - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method test_query_parameter_collection_format" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - if _params.get('pipe') is not None: # noqa: E501 - _query_params.append(('pipe', _params['pipe'])) - _collection_formats['pipe'] = 'pipes' - - if _params.get('ioutil') is not None: # noqa: E501 - _query_params.append(('ioutil', _params['ioutil'])) - _collection_formats['ioutil'] = 'csv' - - if _params.get('http') is not None: # noqa: E501 - _query_params.append(('http', _params['http'])) - _collection_formats['http'] = 'ssv' - - if _params.get('url') is not None: # noqa: E501 - _query_params.append(('url', _params['url'])) - _collection_formats['url'] = 'csv' - - if _params.get('context') is not None: # noqa: E501 - _query_params.append(('context', _params['context'])) - _collection_formats['context'] = 'multi' - - if _params.get('language') is not None: # noqa: E501 - _query_params.append(('language', _params['language'])) - - if _params.get('allow_empty') is not None: # noqa: E501 - _query_params.append(('allowEmpty', _params['allow_empty'])) - - # process the header parameters - _header_params = dict(_params.get('_headers', {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - '/fake/test-query-parameters', 'PUT', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/fake_classname_tags123_api.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/fake_classname_tags123_api.py deleted file mode 100644 index 6a63f0aed765..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/fake_classname_tags123_api.py +++ /dev/null @@ -1,176 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import re # noqa: F401 -import io -import warnings - -from pydantic import validate_arguments, ValidationError -from typing import overload, Optional, Union, Awaitable - -from typing_extensions import Annotated -from pydantic import Field - -from petstore_api.models.client import Client - -from petstore_api.api_client import ApiClient -from petstore_api.api_response import ApiResponse -from petstore_api.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) - - -class FakeClassnameTags123Api: - """NOTE: This class is auto generated by OpenAPI Generator - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - def __init__(self, api_client=None) -> None: - if api_client is None: - api_client = ApiClient.get_default() - self.api_client = api_client - - @validate_arguments - async def test_classname(self, client : Annotated[Client, Field(..., description="client model")], **kwargs) -> Client: # noqa: E501 - """To test class name in snake case # noqa: E501 - - To test class name in snake case # noqa: E501 - - :param client: client model (required) - :type client: Client - :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: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Client - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - message = "Error! Please call the test_classname_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.test_classname_with_http_info(client, **kwargs) # noqa: E501 - - @validate_arguments - async def test_classname_with_http_info(self, client : Annotated[Client, Field(..., description="client model")], **kwargs) -> ApiResponse: # noqa: E501 - """To test class name in snake case # noqa: E501 - - To test class name in snake case # noqa: E501 - - :param client: client model (required) - :type client: Client - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Client, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'client' - ] - _all_params.extend( - [ - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method test_classname" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get('_headers', {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - if _params['client'] is not None: - _body_params = _params['client'] - - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list - - # authentication setting - _auth_settings = ['api_key_query'] # noqa: E501 - - _response_types_map = { - '200': "Client", - } - - return await self.api_client.call_api( - '/fake_classname_test', 'PATCH', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/pet_api.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/pet_api.py deleted file mode 100644 index cb4e3ee8896e..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/pet_api.py +++ /dev/null @@ -1,1239 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import re # noqa: F401 -import io -import warnings - -from pydantic import validate_arguments, ValidationError -from typing import overload, Optional, Union, Awaitable - -from typing_extensions import Annotated -from pydantic import Field, StrictBytes, StrictInt, StrictStr, conlist, validator - -from typing import List, Optional, Union - -from petstore_api.models.api_response import ApiResponse -from petstore_api.models.pet import Pet - -from petstore_api.api_client import ApiClient -from petstore_api.api_response import ApiResponse -from petstore_api.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) - - -class PetApi: - """NOTE: This class is auto generated by OpenAPI Generator - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - def __init__(self, api_client=None) -> None: - if api_client is None: - api_client = ApiClient.get_default() - self.api_client = api_client - - @validate_arguments - async def add_pet(self, pet : Annotated[Pet, Field(..., description="Pet object that needs to be added to the store")], **kwargs) -> None: # noqa: E501 - """Add a new pet to the store # noqa: E501 - - # noqa: E501 - - :param pet: Pet object that needs to be added to the store (required) - :type pet: Pet - :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: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - message = "Error! Please call the add_pet_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.add_pet_with_http_info(pet, **kwargs) # noqa: E501 - - @validate_arguments - async def add_pet_with_http_info(self, pet : Annotated[Pet, Field(..., description="Pet object that needs to be added to the store")], **kwargs) -> ApiResponse: # noqa: E501 - """Add a new pet to the store # noqa: E501 - - # noqa: E501 - - :param pet: Pet object that needs to be added to the store (required) - :type pet: Pet - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = [ - 'pet' - ] - _all_params.extend( - [ - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method add_pet" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get('_headers', {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - if _params['pet'] is not None: - _body_params = _params['pet'] - - # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json', 'application/xml'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list - - # authentication setting - _auth_settings = ['petstore_auth', 'http_signature_test'] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - '/pet', 'POST', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) - - @validate_arguments - async def delete_pet(self, pet_id : Annotated[StrictInt, Field(..., description="Pet id to delete")], api_key : Optional[StrictStr] = None, **kwargs) -> None: # noqa: E501 - """Deletes a pet # noqa: E501 - - # noqa: E501 - - :param pet_id: Pet id to delete (required) - :type pet_id: int - :param api_key: - :type api_key: str - :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: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - message = "Error! Please call the delete_pet_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.delete_pet_with_http_info(pet_id, api_key, **kwargs) # noqa: E501 - - @validate_arguments - async def delete_pet_with_http_info(self, pet_id : Annotated[StrictInt, Field(..., description="Pet id to delete")], api_key : Optional[StrictStr] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Deletes a pet # noqa: E501 - - # noqa: E501 - - :param pet_id: Pet id to delete (required) - :type pet_id: int - :param api_key: - :type api_key: str - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = [ - 'pet_id', - 'api_key' - ] - _all_params.extend( - [ - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_pet" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - if _params['pet_id'] is not None: - _path_params['petId'] = _params['pet_id'] - - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get('_headers', {})) - if _params['api_key'] is not None: - _header_params['api_key'] = _params['api_key'] - - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # authentication setting - _auth_settings = ['petstore_auth'] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - '/pet/{petId}', 'DELETE', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) - - @validate_arguments - async def find_pets_by_status(self, status : Annotated[conlist(StrictStr), Field(..., description="Status values that need to be considered for filter")], **kwargs) -> List[Pet]: # noqa: E501 - """Finds Pets by status # noqa: E501 - - Multiple status values can be provided with comma separated strings # noqa: E501 - - :param status: Status values that need to be considered for filter (required) - :type status: List[str] - :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: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: List[Pet] - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - message = "Error! Please call the find_pets_by_status_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.find_pets_by_status_with_http_info(status, **kwargs) # noqa: E501 - - @validate_arguments - async def find_pets_by_status_with_http_info(self, status : Annotated[conlist(StrictStr), Field(..., description="Status values that need to be considered for filter")], **kwargs) -> ApiResponse: # noqa: E501 - """Finds Pets by status # noqa: E501 - - Multiple status values can be provided with comma separated strings # noqa: E501 - - :param status: Status values that need to be considered for filter (required) - :type status: List[str] - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(List[Pet], status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'status' - ] - _all_params.extend( - [ - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_pets_by_status" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - if _params.get('status') is not None: # noqa: E501 - _query_params.append(('status', _params['status'])) - _collection_formats['status'] = 'csv' - - # process the header parameters - _header_params = dict(_params.get('_headers', {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - ['application/xml', 'application/json']) # noqa: E501 - - # authentication setting - _auth_settings = ['petstore_auth', 'http_signature_test'] # noqa: E501 - - _response_types_map = { - '200': "List[Pet]", - '400': None, - } - - return await self.api_client.call_api( - '/pet/findByStatus', 'GET', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) - - @validate_arguments - async def find_pets_by_tags(self, tags : Annotated[conlist(StrictStr, unique_items=True), Field(..., description="Tags to filter by")], **kwargs) -> List[Pet]: # noqa: E501 - """(Deprecated) Finds Pets by tags # noqa: E501 - - Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. # noqa: E501 - - :param tags: Tags to filter by (required) - :type tags: List[str] - :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: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: List[Pet] - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - message = "Error! Please call the find_pets_by_tags_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.find_pets_by_tags_with_http_info(tags, **kwargs) # noqa: E501 - - @validate_arguments - async def find_pets_by_tags_with_http_info(self, tags : Annotated[conlist(StrictStr, unique_items=True), Field(..., description="Tags to filter by")], **kwargs) -> ApiResponse: # noqa: E501 - """(Deprecated) Finds Pets by tags # noqa: E501 - - Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. # noqa: E501 - - :param tags: Tags to filter by (required) - :type tags: List[str] - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(List[Pet], status_code(int), headers(HTTPHeaderDict)) - """ - - warnings.warn("GET /pet/findByTags is deprecated.", DeprecationWarning) - - _params = locals() - - _all_params = [ - 'tags' - ] - _all_params.extend( - [ - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method find_pets_by_tags" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - if _params.get('tags') is not None: # noqa: E501 - _query_params.append(('tags', _params['tags'])) - _collection_formats['tags'] = 'csv' - - # process the header parameters - _header_params = dict(_params.get('_headers', {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - ['application/xml', 'application/json']) # noqa: E501 - - # authentication setting - _auth_settings = ['petstore_auth', 'http_signature_test'] # noqa: E501 - - _response_types_map = { - '200': "List[Pet]", - '400': None, - } - - return await self.api_client.call_api( - '/pet/findByTags', 'GET', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) - - @validate_arguments - async def get_pet_by_id(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to return")], **kwargs) -> Pet: # noqa: E501 - """Find pet by ID # noqa: E501 - - Returns a single pet # noqa: E501 - - :param pet_id: ID of pet to return (required) - :type pet_id: int - :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: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Pet - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - message = "Error! Please call the get_pet_by_id_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.get_pet_by_id_with_http_info(pet_id, **kwargs) # noqa: E501 - - @validate_arguments - async def get_pet_by_id_with_http_info(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to return")], **kwargs) -> ApiResponse: # noqa: E501 - """Find pet by ID # noqa: E501 - - Returns a single pet # noqa: E501 - - :param pet_id: ID of pet to return (required) - :type pet_id: int - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Pet, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'pet_id' - ] - _all_params.extend( - [ - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_pet_by_id" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - if _params['pet_id'] is not None: - _path_params['petId'] = _params['pet_id'] - - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get('_headers', {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - ['application/xml', 'application/json']) # noqa: E501 - - # authentication setting - _auth_settings = ['api_key'] # noqa: E501 - - _response_types_map = { - '200': "Pet", - '400': None, - '404': None, - } - - return await self.api_client.call_api( - '/pet/{petId}', 'GET', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) - - @validate_arguments - async def update_pet(self, pet : Annotated[Pet, Field(..., description="Pet object that needs to be added to the store")], **kwargs) -> None: # noqa: E501 - """Update an existing pet # noqa: E501 - - # noqa: E501 - - :param pet: Pet object that needs to be added to the store (required) - :type pet: Pet - :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: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - message = "Error! Please call the update_pet_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.update_pet_with_http_info(pet, **kwargs) # noqa: E501 - - @validate_arguments - async def update_pet_with_http_info(self, pet : Annotated[Pet, Field(..., description="Pet object that needs to be added to the store")], **kwargs) -> ApiResponse: # noqa: E501 - """Update an existing pet # noqa: E501 - - # noqa: E501 - - :param pet: Pet object that needs to be added to the store (required) - :type pet: Pet - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = [ - 'pet' - ] - _all_params.extend( - [ - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method update_pet" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get('_headers', {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - if _params['pet'] is not None: - _body_params = _params['pet'] - - # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json', 'application/xml'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list - - # authentication setting - _auth_settings = ['petstore_auth', 'http_signature_test'] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - '/pet', 'PUT', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) - - @validate_arguments - async def update_pet_with_form(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet that needs to be updated")], name : Annotated[Optional[StrictStr], Field(description="Updated name of the pet")] = None, status : Annotated[Optional[StrictStr], Field(description="Updated status of the pet")] = None, **kwargs) -> None: # noqa: E501 - """Updates a pet in the store with form data # noqa: E501 - - # noqa: E501 - - :param pet_id: ID of pet that needs to be updated (required) - :type pet_id: int - :param name: Updated name of the pet - :type name: str - :param status: Updated status of the pet - :type status: str - :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: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - message = "Error! Please call the update_pet_with_form_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.update_pet_with_form_with_http_info(pet_id, name, status, **kwargs) # noqa: E501 - - @validate_arguments - async def update_pet_with_form_with_http_info(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet that needs to be updated")], name : Annotated[Optional[StrictStr], Field(description="Updated name of the pet")] = None, status : Annotated[Optional[StrictStr], Field(description="Updated status of the pet")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """Updates a pet in the store with form data # noqa: E501 - - # noqa: E501 - - :param pet_id: ID of pet that needs to be updated (required) - :type pet_id: int - :param name: Updated name of the pet - :type name: str - :param status: Updated status of the pet - :type status: str - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = [ - 'pet_id', - 'name', - 'status' - ] - _all_params.extend( - [ - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method update_pet_with_form" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - if _params['pet_id'] is not None: - _path_params['petId'] = _params['pet_id'] - - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get('_headers', {})) - # process the form parameters - _form_params = [] - _files = {} - if _params['name'] is not None: - _form_params.append(('name', _params['name'])) - - if _params['status'] is not None: - _form_params.append(('status', _params['status'])) - - # process the body parameter - _body_params = None - # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/x-www-form-urlencoded'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list - - # authentication setting - _auth_settings = ['petstore_auth'] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - '/pet/{petId}', 'POST', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) - - @validate_arguments - async def upload_file(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to update")], additional_metadata : Annotated[Optional[StrictStr], Field(description="Additional data to pass to server")] = None, file : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="file to upload")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """uploads an image # noqa: E501 - - # noqa: E501 - - :param pet_id: ID of pet to update (required) - :type pet_id: int - :param additional_metadata: Additional data to pass to server - :type additional_metadata: str - :param file: file to upload - :type file: bytearray - :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: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: ApiResponse - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - message = "Error! Please call the upload_file_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.upload_file_with_http_info(pet_id, additional_metadata, file, **kwargs) # noqa: E501 - - @validate_arguments - async def upload_file_with_http_info(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to update")], additional_metadata : Annotated[Optional[StrictStr], Field(description="Additional data to pass to server")] = None, file : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="file to upload")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """uploads an image # noqa: E501 - - # noqa: E501 - - :param pet_id: ID of pet to update (required) - :type pet_id: int - :param additional_metadata: Additional data to pass to server - :type additional_metadata: str - :param file: file to upload - :type file: bytearray - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(ApiResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'pet_id', - 'additional_metadata', - 'file' - ] - _all_params.extend( - [ - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method upload_file" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - if _params['pet_id'] is not None: - _path_params['petId'] = _params['pet_id'] - - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get('_headers', {})) - # process the form parameters - _form_params = [] - _files = {} - if _params['additional_metadata'] is not None: - _form_params.append(('additionalMetadata', _params['additional_metadata'])) - - if _params['file'] is not None: - _files['file'] = _params['file'] - - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['multipart/form-data'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list - - # authentication setting - _auth_settings = ['petstore_auth'] # noqa: E501 - - _response_types_map = { - '200': "ApiResponse", - } - - return await self.api_client.call_api( - '/pet/{petId}/uploadImage', 'POST', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) - - @validate_arguments - async def upload_file_with_required_file(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to update")], required_file : Annotated[Union[StrictBytes, StrictStr], Field(..., description="file to upload")], additional_metadata : Annotated[Optional[StrictStr], Field(description="Additional data to pass to server")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """uploads an image (required) # noqa: E501 - - # noqa: E501 - - :param pet_id: ID of pet to update (required) - :type pet_id: int - :param required_file: file to upload (required) - :type required_file: bytearray - :param additional_metadata: Additional data to pass to server - :type additional_metadata: str - :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: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: ApiResponse - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - message = "Error! Please call the upload_file_with_required_file_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.upload_file_with_required_file_with_http_info(pet_id, required_file, additional_metadata, **kwargs) # noqa: E501 - - @validate_arguments - async def upload_file_with_required_file_with_http_info(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to update")], required_file : Annotated[Union[StrictBytes, StrictStr], Field(..., description="file to upload")], additional_metadata : Annotated[Optional[StrictStr], Field(description="Additional data to pass to server")] = None, **kwargs) -> ApiResponse: # noqa: E501 - """uploads an image (required) # noqa: E501 - - # noqa: E501 - - :param pet_id: ID of pet to update (required) - :type pet_id: int - :param required_file: file to upload (required) - :type required_file: bytearray - :param additional_metadata: Additional data to pass to server - :type additional_metadata: str - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(ApiResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'pet_id', - 'required_file', - 'additional_metadata' - ] - _all_params.extend( - [ - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method upload_file_with_required_file" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - if _params['pet_id'] is not None: - _path_params['petId'] = _params['pet_id'] - - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get('_headers', {})) - # process the form parameters - _form_params = [] - _files = {} - if _params['additional_metadata'] is not None: - _form_params.append(('additionalMetadata', _params['additional_metadata'])) - - if _params['required_file'] is not None: - _files['requiredFile'] = _params['required_file'] - - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['multipart/form-data'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list - - # authentication setting - _auth_settings = ['petstore_auth'] # noqa: E501 - - _response_types_map = { - '200': "ApiResponse", - } - - return await self.api_client.call_api( - '/fake/{petId}/uploadImageWithRequiredFile', 'POST', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/store_api.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/store_api.py deleted file mode 100644 index a904a1f2c572..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/store_api.py +++ /dev/null @@ -1,539 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import re # noqa: F401 -import io -import warnings - -from pydantic import validate_arguments, ValidationError -from typing import overload, Optional, Union, Awaitable - -from typing_extensions import Annotated -from pydantic import Field, StrictStr, conint - -from typing import Dict - -from petstore_api.models.order import Order - -from petstore_api.api_client import ApiClient -from petstore_api.api_response import ApiResponse -from petstore_api.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) - - -class StoreApi: - """NOTE: This class is auto generated by OpenAPI Generator - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - def __init__(self, api_client=None) -> None: - if api_client is None: - api_client = ApiClient.get_default() - self.api_client = api_client - - @validate_arguments - async def delete_order(self, order_id : Annotated[StrictStr, Field(..., description="ID of the order that needs to be deleted")], **kwargs) -> None: # 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 - - :param order_id: ID of the order that needs to be deleted (required) - :type order_id: str - :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: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - message = "Error! Please call the delete_order_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.delete_order_with_http_info(order_id, **kwargs) # noqa: E501 - - @validate_arguments - async def delete_order_with_http_info(self, order_id : Annotated[StrictStr, Field(..., description="ID of the order that needs to be deleted")], **kwargs) -> ApiResponse: # 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 - - :param order_id: ID of the order that needs to be deleted (required) - :type order_id: str - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = [ - 'order_id' - ] - _all_params.extend( - [ - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_order" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - if _params['order_id'] is not None: - _path_params['order_id'] = _params['order_id'] - - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get('_headers', {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - '/store/order/{order_id}', 'DELETE', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) - - @validate_arguments - async def get_inventory(self, **kwargs) -> Dict[str, int]: # noqa: E501 - """Returns pet inventories by status # noqa: E501 - - Returns a map of status codes to quantities # noqa: E501 - - :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: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Dict[str, int] - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - message = "Error! Please call the get_inventory_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.get_inventory_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments - async def get_inventory_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 - """Returns pet inventories by status # noqa: E501 - - Returns a map of status codes to quantities # noqa: E501 - - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Dict[str, int], status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - ] - _all_params.extend( - [ - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_inventory" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get('_headers', {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # authentication setting - _auth_settings = ['api_key'] # noqa: E501 - - _response_types_map = { - '200': "Dict[str, int]", - } - - return await self.api_client.call_api( - '/store/inventory', 'GET', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) - - @validate_arguments - async def get_order_by_id(self, order_id : Annotated[conint(strict=True, le=5, ge=1), Field(..., description="ID of pet that needs to be fetched")], **kwargs) -> Order: # 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 - - :param order_id: ID of pet that needs to be fetched (required) - :type order_id: int - :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: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Order - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - message = "Error! Please call the get_order_by_id_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.get_order_by_id_with_http_info(order_id, **kwargs) # noqa: E501 - - @validate_arguments - async def get_order_by_id_with_http_info(self, order_id : Annotated[conint(strict=True, le=5, ge=1), Field(..., description="ID of pet that needs to be fetched")], **kwargs) -> ApiResponse: # 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 - - :param order_id: ID of pet that needs to be fetched (required) - :type order_id: int - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Order, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'order_id' - ] - _all_params.extend( - [ - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_order_by_id" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - if _params['order_id'] is not None: - _path_params['order_id'] = _params['order_id'] - - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get('_headers', {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - ['application/xml', 'application/json']) # noqa: E501 - - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = { - '200': "Order", - '400': None, - '404': None, - } - - return await self.api_client.call_api( - '/store/order/{order_id}', 'GET', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) - - @validate_arguments - async def place_order(self, order : Annotated[Order, Field(..., description="order placed for purchasing the pet")], **kwargs) -> Order: # noqa: E501 - """Place an order for a pet # noqa: E501 - - # noqa: E501 - - :param order: order placed for purchasing the pet (required) - :type order: Order - :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: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Order - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - message = "Error! Please call the place_order_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.place_order_with_http_info(order, **kwargs) # noqa: E501 - - @validate_arguments - async def place_order_with_http_info(self, order : Annotated[Order, Field(..., description="order placed for purchasing the pet")], **kwargs) -> ApiResponse: # noqa: E501 - """Place an order for a pet # noqa: E501 - - # noqa: E501 - - :param order: order placed for purchasing the pet (required) - :type order: Order - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Order, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'order' - ] - _all_params.extend( - [ - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method place_order" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get('_headers', {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - if _params['order'] is not None: - _body_params = _params['order'] - - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - ['application/xml', 'application/json']) # noqa: E501 - - # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list - - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = { - '200': "Order", - '400': None, - } - - return await self.api_client.call_api( - '/store/order', 'POST', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/user_api.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/user_api.py deleted file mode 100644 index 379693e4bd0b..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/user_api.py +++ /dev/null @@ -1,1055 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import re # noqa: F401 -import io -import warnings - -from pydantic import validate_arguments, ValidationError -from typing import overload, Optional, Union, Awaitable - -from typing_extensions import Annotated -from pydantic import Field, StrictStr, conlist - -from petstore_api.models.user import User - -from petstore_api.api_client import ApiClient -from petstore_api.api_response import ApiResponse -from petstore_api.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) - - -class UserApi: - """NOTE: This class is auto generated by OpenAPI Generator - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - def __init__(self, api_client=None) -> None: - if api_client is None: - api_client = ApiClient.get_default() - self.api_client = api_client - - @validate_arguments - async def create_user(self, user : Annotated[User, Field(..., description="Created user object")], **kwargs) -> None: # noqa: E501 - """Create user # noqa: E501 - - This can only be done by the logged in user. # noqa: E501 - - :param user: Created user object (required) - :type user: User - :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: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - message = "Error! Please call the create_user_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.create_user_with_http_info(user, **kwargs) # noqa: E501 - - @validate_arguments - async def create_user_with_http_info(self, user : Annotated[User, Field(..., description="Created user object")], **kwargs) -> ApiResponse: # noqa: E501 - """Create user # noqa: E501 - - This can only be done by the logged in user. # noqa: E501 - - :param user: Created user object (required) - :type user: User - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _hosts = [ - 'http://petstore.swagger.io/v2', - 'http://path-server-test.petstore.local/v2', - 'http://{server}.swagger.io:{port}/v2' - ] - _host = _hosts[0] - if kwargs.get('_host_index'): - _host_index = int(kwargs.get('_host_index')) - if _host_index < 0 or _host_index >= len(_hosts): - raise ApiValueError( - "Invalid host index. Must be 0 <= index < %s" - % len(_host) - ) - _host = _hosts[_host_index] - _params = locals() - - _all_params = [ - 'user' - ] - _all_params.extend( - [ - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params and _key != "_host_index": - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_user" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get('_headers', {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - if _params['user'] is not None: - _body_params = _params['user'] - - # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list - - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - '/user', 'POST', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - _host=_host, - collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) - - @validate_arguments - async def create_users_with_array_input(self, user : Annotated[conlist(User), Field(..., description="List of user object")], **kwargs) -> None: # noqa: E501 - """Creates list of users with given input array # noqa: E501 - - # noqa: E501 - - :param user: List of user object (required) - :type user: List[User] - :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: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - message = "Error! Please call the create_users_with_array_input_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.create_users_with_array_input_with_http_info(user, **kwargs) # noqa: E501 - - @validate_arguments - async def create_users_with_array_input_with_http_info(self, user : Annotated[conlist(User), Field(..., description="List of user object")], **kwargs) -> ApiResponse: # noqa: E501 - """Creates list of users with given input array # noqa: E501 - - # noqa: E501 - - :param user: List of user object (required) - :type user: List[User] - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = [ - 'user' - ] - _all_params.extend( - [ - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_users_with_array_input" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get('_headers', {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - if _params['user'] is not None: - _body_params = _params['user'] - - # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list - - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - '/user/createWithArray', 'POST', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) - - @validate_arguments - async def create_users_with_list_input(self, user : Annotated[conlist(User), Field(..., description="List of user object")], **kwargs) -> None: # noqa: E501 - """Creates list of users with given input array # noqa: E501 - - # noqa: E501 - - :param user: List of user object (required) - :type user: List[User] - :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: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - message = "Error! Please call the create_users_with_list_input_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.create_users_with_list_input_with_http_info(user, **kwargs) # noqa: E501 - - @validate_arguments - async def create_users_with_list_input_with_http_info(self, user : Annotated[conlist(User), Field(..., description="List of user object")], **kwargs) -> ApiResponse: # noqa: E501 - """Creates list of users with given input array # noqa: E501 - - # noqa: E501 - - :param user: List of user object (required) - :type user: List[User] - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = [ - 'user' - ] - _all_params.extend( - [ - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_users_with_list_input" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get('_headers', {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - if _params['user'] is not None: - _body_params = _params['user'] - - # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list - - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - '/user/createWithList', 'POST', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) - - @validate_arguments - async def delete_user(self, username : Annotated[StrictStr, Field(..., description="The name that needs to be deleted")], **kwargs) -> None: # noqa: E501 - """Delete user # noqa: E501 - - This can only be done by the logged in user. # noqa: E501 - - :param username: The name that needs to be deleted (required) - :type username: str - :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: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - message = "Error! Please call the delete_user_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.delete_user_with_http_info(username, **kwargs) # noqa: E501 - - @validate_arguments - async def delete_user_with_http_info(self, username : Annotated[StrictStr, Field(..., description="The name that needs to be deleted")], **kwargs) -> ApiResponse: # noqa: E501 - """Delete user # noqa: E501 - - This can only be done by the logged in user. # noqa: E501 - - :param username: The name that needs to be deleted (required) - :type username: str - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = [ - 'username' - ] - _all_params.extend( - [ - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_user" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - if _params['username'] is not None: - _path_params['username'] = _params['username'] - - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get('_headers', {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - '/user/{username}', 'DELETE', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) - - @validate_arguments - async def get_user_by_name(self, username : Annotated[StrictStr, Field(..., description="The name that needs to be fetched. Use user1 for testing.")], **kwargs) -> User: # noqa: E501 - """Get user by user name # noqa: E501 - - # noqa: E501 - - :param username: The name that needs to be fetched. Use user1 for testing. (required) - :type username: str - :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: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: User - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - message = "Error! Please call the get_user_by_name_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.get_user_by_name_with_http_info(username, **kwargs) # noqa: E501 - - @validate_arguments - async def get_user_by_name_with_http_info(self, username : Annotated[StrictStr, Field(..., description="The name that needs to be fetched. Use user1 for testing.")], **kwargs) -> ApiResponse: # noqa: E501 - """Get user by user name # noqa: E501 - - # noqa: E501 - - :param username: The name that needs to be fetched. Use user1 for testing. (required) - :type username: str - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(User, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'username' - ] - _all_params.extend( - [ - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_user_by_name" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - if _params['username'] is not None: - _path_params['username'] = _params['username'] - - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get('_headers', {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - ['application/xml', 'application/json']) # noqa: E501 - - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = { - '200': "User", - '400': None, - '404': None, - } - - return await self.api_client.call_api( - '/user/{username}', 'GET', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) - - @validate_arguments - async def login_user(self, username : Annotated[StrictStr, Field(..., description="The user name for login")], password : Annotated[StrictStr, Field(..., description="The password for login in clear text")], **kwargs) -> str: # noqa: E501 - """Logs user into the system # noqa: E501 - - # noqa: E501 - - :param username: The user name for login (required) - :type username: str - :param password: The password for login in clear text (required) - :type password: str - :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: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: str - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - message = "Error! Please call the login_user_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.login_user_with_http_info(username, password, **kwargs) # noqa: E501 - - @validate_arguments - async def login_user_with_http_info(self, username : Annotated[StrictStr, Field(..., description="The user name for login")], password : Annotated[StrictStr, Field(..., description="The password for login in clear text")], **kwargs) -> ApiResponse: # noqa: E501 - """Logs user into the system # noqa: E501 - - # noqa: E501 - - :param username: The user name for login (required) - :type username: str - :param password: The password for login in clear text (required) - :type password: str - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(str, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [ - 'username', - 'password' - ] - _all_params.extend( - [ - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method login_user" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - if _params.get('username') is not None: # noqa: E501 - _query_params.append(('username', _params['username'])) - - if _params.get('password') is not None: # noqa: E501 - _query_params.append(('password', _params['password'])) - - # process the header parameters - _header_params = dict(_params.get('_headers', {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params['Accept'] = self.api_client.select_header_accept( - ['application/xml', 'application/json']) # noqa: E501 - - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = { - '200': "str", - '400': None, - } - - return await self.api_client.call_api( - '/user/login', 'GET', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) - - @validate_arguments - async def logout_user(self, **kwargs) -> None: # noqa: E501 - """Logs out current logged in user session # noqa: E501 - - # noqa: E501 - - :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: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - message = "Error! Please call the logout_user_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.logout_user_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments - async def logout_user_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 - """Logs out current logged in user session # noqa: E501 - - # noqa: E501 - - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = [ - ] - _all_params.extend( - [ - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method logout_user" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get('_headers', {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - '/user/logout', 'GET', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) - - @validate_arguments - async def update_user(self, username : Annotated[StrictStr, Field(..., description="name that need to be deleted")], user : Annotated[User, Field(..., description="Updated user object")], **kwargs) -> None: # noqa: E501 - """Updated user # noqa: E501 - - This can only be done by the logged in user. # noqa: E501 - - :param username: name that need to be deleted (required) - :type username: str - :param user: Updated user object (required) - :type user: User - :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: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs['_return_http_data_only'] = True - if '_preload_content' in kwargs: - message = "Error! Please call the update_user_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return await self.update_user_with_http_info(username, user, **kwargs) # noqa: E501 - - @validate_arguments - async def update_user_with_http_info(self, username : Annotated[StrictStr, Field(..., description="name that need to be deleted")], user : Annotated[User, Field(..., description="Updated user object")], **kwargs) -> ApiResponse: # noqa: E501 - """Updated user # noqa: E501 - - This can only be done by the logged in user. # noqa: E501 - - :param username: name that need to be deleted (required) - :type username: str - :param user: Updated user object (required) - :type user: User - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = [ - 'username', - 'user' - ] - _all_params.extend( - [ - '_return_http_data_only', - '_preload_content', - '_request_timeout', - '_request_auth', - '_content_type', - '_headers' - ] - ) - - # validate the arguments - for _key, _val in _params['kwargs'].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method update_user" % _key - ) - _params[_key] = _val - del _params['kwargs'] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - if _params['username'] is not None: - _path_params['username'] = _params['username'] - - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get('_headers', {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - if _params['user'] is not None: - _body_params = _params['user'] - - # set the HTTP header `Content-Type` - _content_types_list = _params.get('_content_type', - self.api_client.select_header_content_type( - ['application/json'])) - if _content_types_list: - _header_params['Content-Type'] = _content_types_list - - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return await self.api_client.call_api( - '/user/{username}', 'PUT', - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=_params.get('_preload_content', True), - _request_timeout=_params.get('_request_timeout'), - collection_formats=_collection_formats, - _request_auth=_params.get('_request_auth')) diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api_client.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api_client.py deleted file mode 100644 index 733ddaed7c3e..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api_client.py +++ /dev/null @@ -1,737 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import atexit -import datetime -from dateutil.parser import parse -import json -import mimetypes -import os -import re -import tempfile - -from urllib.parse import quote - -from petstore_api.configuration import Configuration -from petstore_api.api_response import ApiResponse -import petstore_api.models -from petstore_api import rest -from petstore_api.exceptions import ApiValueError, ApiException - - -class ApiClient: - """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. - - :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 - """ - - PRIMITIVE_TYPES = (float, bool, bytes, str, int) - NATIVE_TYPES_MAPPING = { - 'int': int, - 'long': int, # TODO remove as only py3 is supported? - '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) -> None: - # use default configuration if none is provided - if configuration is None: - configuration = Configuration.get_default() - self.configuration = configuration - - 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' - self.client_side_validation = configuration.client_side_validation - - async def __aenter__(self): - return self - - async def __aexit__(self, exc_type, exc_value, traceback): - await self.close() - - async def close(self): - await self.rest_client.close() - - @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 - - - _default = None - - @classmethod - def get_default(cls): - """Return new instance of ApiClient. - - This method returns newly created, based on default constructor, - object of ApiClient class or returns a copy of default - ApiClient. - - :return: The ApiClient object. - """ - if cls._default is None: - cls._default = ApiClient() - return cls._default - - @classmethod - def set_default(cls, default): - """Set default instance of ApiClient. - - It stores default ApiClient. - - :param default: object of ApiClient. - """ - cls._default = default - - async def __call_api( - self, resource_path, method, path_params=None, - query_params=None, header_params=None, body=None, post_params=None, - files=None, response_types_map=None, auth_settings=None, - _return_http_data_only=None, collection_formats=None, - _preload_content=True, _request_timeout=None, _host=None, - _request_auth=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) - ) - - # 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, - resource_path, method, body, - request_auth=_request_auth) - - # 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 - - # query parameters - if query_params: - query_params = self.sanitize_for_serialization(query_params) - url_query = self.parameters_to_url_query(query_params, - collection_formats) - url += "?" + url_query - - try: - # perform request and return response - response_data = await 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) - except ApiException as e: - if e.body: - e.body = e.body.decode('utf-8') - raise e - - self.last_response = response_data - - return_data = None # assuming deserialization is not needed - # data needs deserialization or returns HTTP data (deserialized) only - if _preload_content or _return_http_data_only: - response_type = response_types_map.get(str(response_data.status), None) - if not response_type and isinstance(response_data.status, int) and 100 <= response_data.status <= 599: - # if not found, look for '1XX', '2XX', etc. - response_type = response_types_map.get(str(response_data.status)[0] + "XX", None) - - if response_type == "bytearray": - response_data.data = response_data.data - else: - match = None - content_type = response_data.getheader('content-type') - if content_type is not None: - match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type) - encoding = match.group(1) if match else "utf-8" - response_data.data = response_data.data.decode(encoding) - - # deserialize response data - if response_type == "bytearray": - return_data = response_data.data - elif response_type: - return_data = self.deserialize(response_data, response_type) - else: - return_data = None - - if _return_http_data_only: - return return_data - else: - return ApiResponse(status_code = response_data.status, - data = return_data, - headers = response_data.getheaders(), - raw_data = response_data.data) - - 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.to_dict() - - return {key: self.sanitize_for_serialization(val) - for key, val in obj_dict.items()} - - 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 isinstance(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 data.items()} - - # 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_datetime(data) - else: - return self.__deserialize_model(data, klass) - - async def call_api(self, resource_path, method, - path_params=None, query_params=None, header_params=None, - body=None, post_params=None, files=None, - response_types_map=None, auth_settings=None, - _return_http_data_only=None, - collection_formats=None, _preload_content=True, - _request_timeout=None, _host=None, _request_auth=None): - """Makes the HTTP request (synchronous) and returns deserialized data. - - :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 _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :param collection_formats: dict of collection formats for path, query, - header, and post parameters. - :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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_token: dict, optional - :return: - The response. - """ - args = ( - resource_path, - method, - path_params, - query_params, - header_params, - body, - post_params, - files, - response_types_map, - auth_settings, - _return_http_data_only, - collection_formats, - _preload_content, - _request_timeout, - _host, - _request_auth, - ) - return await self.__call_api(*args) - - async 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 await self.rest_client.get_request(url, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - headers=headers) - elif method == "HEAD": - return await self.rest_client.head_request(url, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - headers=headers) - elif method == "OPTIONS": - return await self.rest_client.options_request(url, - query_params=query_params, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout) - elif method == "POST": - return await self.rest_client.post_request(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 await self.rest_client.put_request(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 await self.rest_client.patch_request(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 await self.rest_client.delete_request(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 params.items() 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 parameters_to_url_query(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: URL query string (e.g. a=Hello%20World&b=123) - """ - new_params = [] - if collection_formats is None: - collection_formats = {} - for k, v in params.items() if isinstance(params, dict) else params: # noqa: E501 - if isinstance(v, (int, float)): - v = str(v) - if isinstance(v, bool): - v = str(v).lower() - if isinstance(v, dict): - v = json.dumps(v) - - 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(quote(str(value)) for value in v))) - else: - new_params.append((k, quote(str(v)))) - - return "&".join(["=".join(item) for item in 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 files.items(): - 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 - - for accept in accepts: - if re.search('json', accept, re.IGNORECASE): - return accept - - return accepts[0] - - 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 None - - for content_type in content_types: - if re.search('json', content_type, re.IGNORECASE): - return content_type - - return content_types[0] - - def update_params_for_auth(self, headers, queries, auth_settings, - resource_path, method, body, - request_auth=None): - """Updates header and query params based on authentication setting. - - :param headers: Header parameters dict to be updated. - :param queries: Query parameters tuple list to be updated. - :param auth_settings: Authentication setting identifiers list. - :resource_path: A string representation of the HTTP request resource path. - :method: A string representation of the HTTP request method. - :body: A object representing the body of the HTTP request. - The object type is the return value of sanitize_for_serialization(). - :param request_auth: if set, the provided settings will - override the token in the configuration. - """ - if not auth_settings: - return - - if request_auth: - self._apply_auth_params(headers, queries, - resource_path, method, body, - request_auth) - return - - for auth in auth_settings: - auth_setting = self.configuration.auth_settings().get(auth) - if auth_setting: - self._apply_auth_params(headers, queries, - resource_path, method, body, - auth_setting) - - def _apply_auth_params(self, headers, queries, - resource_path, method, body, - auth_setting): - """Updates the request parameters based on a single auth_setting - - :param headers: Header parameters dict to be updated. - :param queries: Query parameters tuple list to be updated. - :resource_path: A string representation of the HTTP request resource path. - :method: A string representation of the HTTP request method. - :body: A object representing the body of the HTTP request. - The object type is the return value of sanitize_for_serialization(). - :param auth_setting: auth settings for the endpoint - """ - if auth_setting['in'] == 'cookie': - headers['Cookie'] = auth_setting['value'] - elif auth_setting['in'] == 'header': - if auth_setting['type'] != 'http-signature': - headers[auth_setting['key']] = auth_setting['value'] - else: - # The HTTP signature scheme requires multiple HTTP headers - # that are calculated dynamically. - signing_info = self.configuration.signing_info - auth_headers = signing_info.get_http_signature_headers( - resource_path, method, headers, body, queries) - headers.update(auth_headers) - elif auth_setting['in'] == 'query': - queries.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 str(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: - 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_datetime(self, string): - """Deserializes string to datetime. - - The string should be in iso8601 datetime format. - - :param string: str. - :return: datetime. - """ - try: - 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. - """ - - return klass.from_dict(data) diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api_response.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api_response.py deleted file mode 100644 index a0b62b95246c..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api_response.py +++ /dev/null @@ -1,25 +0,0 @@ -"""API response object.""" - -from __future__ import annotations -from typing import Any, Dict, Optional -from pydantic import Field, StrictInt, StrictStr - -class ApiResponse: - """ - API response object - """ - - status_code: Optional[StrictInt] = Field(None, description="HTTP status code") - headers: Optional[Dict[StrictStr, StrictStr]] = Field(None, description="HTTP headers") - data: Optional[Any] = Field(None, description="Deserialized data given the data type") - raw_data: Optional[Any] = Field(None, description="Raw data (HTTP response body)") - - def __init__(self, - status_code=None, - headers=None, - data=None, - raw_data=None) -> None: - self.status_code = status_code - self.headers = headers - self.data = data - self.raw_data = raw_data diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/configuration.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/configuration.py deleted file mode 100644 index 1e0b9acbc97c..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/configuration.py +++ /dev/null @@ -1,601 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import copy -import logging -import sys -import urllib3 - -import http.client as httplib - -JSON_SCHEMA_VALIDATION_KEYWORDS = { - 'multipleOf', 'maximum', 'exclusiveMaximum', - 'minimum', 'exclusiveMinimum', 'maxLength', - 'minLength', 'pattern', 'maxItems', 'minItems' -} - -class Configuration: - """This class contains various settings of the API client. - - :param host: Base url. - :param api_key: Dict to store API key(s). - Each entry in the dict specifies an API key. - The dict key is the name of the security scheme in the OAS specification. - The dict value is the API key secret. - :param api_key_prefix: Dict to store API prefix (e.g. Bearer). - The dict key is the name of the security scheme in the OAS specification. - The dict value is an API key prefix when generating the auth data. - :param username: Username for HTTP basic authentication. - :param password: Password for HTTP basic authentication. - :param access_token: Access token. - :param signing_info: Configuration parameters for the HTTP signature security scheme. - Must be an instance of petstore_api.signing.HttpSigningConfiguration - :param server_index: Index to servers configuration. - :param server_variables: Mapping with string values to replace variables in - templated server configuration. The validation of enums is performed for - variables with defined enum values before. - :param server_operation_index: Mapping from operation ID to an index to server - configuration. - :param server_operation_variables: Mapping from operation ID to a mapping with - string values to replace variables in templated server configuration. - The validation of enums is performed for variables with defined enum - values before. - :param ssl_ca_cert: str - the path to a file of concatenated CA certificates - in PEM format. - - :Example: - - API Key Authentication Example. - Given the following security scheme in the OpenAPI specification: - components: - securitySchemes: - cookieAuth: # name for the security scheme - type: apiKey - in: cookie - name: JSESSIONID # cookie name - - You can programmatically set the cookie: - -conf = petstore_api.Configuration( - api_key={'cookieAuth': 'abc123'} - api_key_prefix={'cookieAuth': 'JSESSIONID'} -) - - The following cookie will be added to the HTTP request: - Cookie: JSESSIONID abc123 - - HTTP Basic Authentication Example. - Given the following security scheme in the OpenAPI specification: - components: - securitySchemes: - http_basic_auth: - type: http - scheme: basic - - Configure API client with HTTP basic authentication: - -conf = petstore_api.Configuration( - username='the-user', - password='the-password', -) - - - HTTP Signature Authentication Example. - Given the following security scheme in the OpenAPI specification: - components: - securitySchemes: - http_basic_auth: - type: http - scheme: signature - - Configure API client with HTTP signature authentication. Use the 'hs2019' signature scheme, - sign the HTTP requests with the RSA-SSA-PSS signature algorithm, and set the expiration time - of the signature to 5 minutes after the signature has been created. - Note you can use the constants defined in the petstore_api.signing module, and you can - also specify arbitrary HTTP headers to be included in the HTTP signature, except for the - 'Authorization' header, which is used to carry the signature. - - One may be tempted to sign all headers by default, but in practice it rarely works. - This is because explicit proxies, transparent proxies, TLS termination endpoints or - load balancers may add/modify/remove headers. Include the HTTP headers that you know - are not going to be modified in transit. - -conf = petstore_api.Configuration( - signing_info = petstore_api.signing.HttpSigningConfiguration( - key_id = 'my-key-id', - private_key_path = 'rsa.pem', - signing_scheme = petstore_api.signing.SCHEME_HS2019, - signing_algorithm = petstore_api.signing.ALGORITHM_RSASSA_PSS, - signed_headers = [petstore_api.signing.HEADER_REQUEST_TARGET, - petstore_api.signing.HEADER_CREATED, - petstore_api.signing.HEADER_EXPIRES, - petstore_api.signing.HEADER_HOST, - petstore_api.signing.HEADER_DATE, - petstore_api.signing.HEADER_DIGEST, - 'Content-Type', - 'User-Agent' - ], - signature_max_validity = datetime.timedelta(minutes=5) - ) -) - """ - - _default = None - - def __init__(self, host=None, - api_key=None, api_key_prefix=None, - username=None, password=None, - access_token=None, - signing_info=None, - server_index=None, server_variables=None, - server_operation_index=None, server_operation_variables=None, - ssl_ca_cert=None, - ) -> None: - """Constructor - """ - self._base_path = "http://petstore.swagger.io:80/v2" if host is None else host - """Default Base url - """ - self.server_index = 0 if server_index is None and host is None else server_index - self.server_operation_index = server_operation_index or {} - """Default server index - """ - self.server_variables = server_variables or {} - self.server_operation_variables = server_operation_variables or {} - """Default server variables - """ - self.temp_folder_path = None - """Temp file folder for downloading files - """ - # Authentication Settings - self.api_key = {} - if api_key: - self.api_key = api_key - """dict to store API key(s) - """ - self.api_key_prefix = {} - if api_key_prefix: - 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 - """ - self.password = password - """Password for HTTP basic authentication - """ - self.access_token = access_token - """Access token - """ - if signing_info is not None: - signing_info.host = host - self.signing_info = signing_info - """The HTTP signing configuration - """ - self.logger = {} - """Logging Settings - """ - self.logger["package_logger"] = logging.getLogger("petstore_api") - self.logger["urllib3_logger"] = logging.getLogger("urllib3") - self.logger_format = '%(asctime)s %(levelname)s %(message)s' - """Log format - """ - self.logger_stream_handler = None - """Log stream handler - """ - self.logger_file_handler = None - """Log file handler - """ - self.logger_file = None - """Debug file location - """ - self.debug = False - """Debug switch - """ - - self.verify_ssl = True - """SSL/TLS verification - Set this to false to skip verifying SSL certificate when calling API - from https server. - """ - self.ssl_ca_cert = ssl_ca_cert - """Set this to customize the certificate file to verify the peer. - """ - self.cert_file = None - """client certificate file - """ - self.key_file = None - """client key file - """ - self.assert_hostname = None - """Set this to True/False to enable/disable SSL hostname verification. - """ - self.tls_server_name = None - """SSL/TLS Server Name Indication (SNI) - Set this to the SNI value expected by the server. - """ - - self.connection_pool_maxsize = 100 - """This value is passed to the aiohttp to limit simultaneous connections. - Default values is 100, None means no-limit. - """ - - self.proxy = None - """Proxy URL - """ - self.proxy_headers = None - """Proxy headers - """ - self.safe_chars_for_path_param = '' - """Safe chars for path_param - """ - self.retries = None - """Adding retries to override urllib3 default value 3 - """ - # Enable client side validation - self.client_side_validation = True - - self.socket_options = None - """Options to pass down to the underlying urllib3 socket - """ - - self.datetime_format = "%Y-%m-%dT%H:%M:%S.%f%z" - """datetime format - """ - - self.date_format = "%Y-%m-%d" - """date format - """ - - def __deepcopy__(self, memo): - cls = self.__class__ - result = cls.__new__(cls) - memo[id(self)] = result - for k, v in self.__dict__.items(): - if k not in ('logger', 'logger_file_handler'): - setattr(result, k, copy.deepcopy(v, memo)) - # shallow copy of loggers - result.logger = copy.copy(self.logger) - # use setters to configure loggers - result.logger_file = self.logger_file - result.debug = self.debug - return result - - def __setattr__(self, name, value): - object.__setattr__(self, name, value) - if name == "signing_info" and value is not None: - # Ensure the host parameter from signing info is the same as - # Configuration.host. - value.host = self.host - - @classmethod - def set_default(cls, default): - """Set default instance of configuration. - - It stores default configuration, which can be - returned by get_default_copy method. - - :param default: object of Configuration - """ - cls._default = default - - @classmethod - def get_default_copy(cls): - """Deprecated. Please use `get_default` instead. - - Deprecated. Please use `get_default` instead. - - :return: The configuration object. - """ - return cls.get_default() - - @classmethod - def get_default(cls): - """Return the default configuration. - - This method returns newly created, based on default constructor, - object of Configuration class or returns a copy of default - configuration. - - :return: The configuration object. - """ - if cls._default is None: - cls._default = Configuration() - return cls._default - - @property - def logger_file(self): - """The logger file. - - If the logger_file is None, then add stream handler and remove file - handler. Otherwise, add file handler and remove stream handler. - - :param value: The logger_file path. - :type: str - """ - return self.__logger_file - - @logger_file.setter - def logger_file(self, value): - """The logger file. - - If the logger_file is None, then add stream handler and remove file - handler. Otherwise, add file handler and remove stream handler. - - :param value: The logger_file path. - :type: str - """ - self.__logger_file = value - if self.__logger_file: - # If set logging file, - # then add file handler and remove stream handler. - self.logger_file_handler = logging.FileHandler(self.__logger_file) - self.logger_file_handler.setFormatter(self.logger_formatter) - for _, logger in self.logger.items(): - logger.addHandler(self.logger_file_handler) - - @property - def debug(self): - """Debug status - - :param value: The debug status, True or False. - :type: bool - """ - return self.__debug - - @debug.setter - def debug(self, value): - """Debug status - - :param value: The debug status, True or False. - :type: bool - """ - self.__debug = value - if self.__debug: - # if debug status is True, turn on debug logging - for _, logger in self.logger.items(): - logger.setLevel(logging.DEBUG) - # turn on httplib debug - httplib.HTTPConnection.debuglevel = 1 - else: - # if debug status is False, turn off debug logging, - # setting log level to default `logging.WARNING` - for _, logger in self.logger.items(): - logger.setLevel(logging.WARNING) - # turn off httplib debug - httplib.HTTPConnection.debuglevel = 0 - - @property - def logger_format(self): - """The logger format. - - The logger_formatter will be updated when sets logger_format. - - :param value: The format string. - :type: str - """ - return self.__logger_format - - @logger_format.setter - def logger_format(self, value): - """The logger format. - - The logger_formatter will be updated when sets logger_format. - - :param value: The format string. - :type: str - """ - self.__logger_format = value - self.logger_formatter = logging.Formatter(self.__logger_format) - - def get_api_key_with_prefix(self, identifier, alias=None): - """Gets API key (with prefix if set). - - :param identifier: The identifier of apiKey. - :param alias: The alternative identifier of apiKey. - :return: The token for api key authentication. - """ - if self.refresh_api_key_hook is not None: - self.refresh_api_key_hook(self) - key = self.api_key.get(identifier, self.api_key.get(alias) if alias is not None else None) - 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). - - :return: The token for basic HTTP authentication. - """ - username = "" - if self.username is not None: - username = self.username - password = "" - if self.password is not None: - password = self.password - return urllib3.util.make_headers( - basic_auth=username + ':' + password - ).get('authorization') - - def auth_settings(self): - """Gets Auth Settings dict for api client. - - :return: The Auth Settings information dict. - """ - auth = {} - if self.access_token is not None: - auth['petstore_auth'] = { - 'type': 'oauth2', - 'in': 'header', - 'key': 'Authorization', - 'value': 'Bearer ' + self.access_token - } - if 'api_key' in self.api_key: - auth['api_key'] = { - 'type': 'api_key', - 'in': 'header', - 'key': 'api_key', - 'value': self.get_api_key_with_prefix( - 'api_key', - ), - } - if 'api_key_query' in self.api_key: - auth['api_key_query'] = { - 'type': 'api_key', - 'in': 'query', - 'key': 'api_key_query', - 'value': self.get_api_key_with_prefix( - 'api_key_query', - ), - } - if self.username is not None and self.password is not None: - auth['http_basic_test'] = { - 'type': 'basic', - 'in': 'header', - 'key': 'Authorization', - 'value': self.get_basic_auth_token() - } - if self.access_token is not None: - auth['bearer_test'] = { - 'type': 'bearer', - 'in': 'header', - 'format': 'JWT', - 'key': 'Authorization', - 'value': 'Bearer ' + self.access_token - } - if self.signing_info is not None: - auth['http_signature_test'] = { - 'type': 'http-signature', - 'in': 'header', - 'key': 'Authorization', - 'value': None # Signature headers are calculated for every HTTP request - } - return auth - - def to_debug_report(self): - """Gets the essential information for debugging. - - :return: The report for debugging. - """ - return "Python SDK Debug Report:\n"\ - "OS: {env}\n"\ - "Python Version: {pyversion}\n"\ - "Version of the API: 1.0.0\n"\ - "SDK Package Version: 1.0.0".\ - format(env=sys.platform, pyversion=sys.version) - - def get_host_settings(self): - """Gets an array of host settings - - :return: An array of host settings - """ - return [ - { - 'url': "http://{server}.swagger.io:{port}/v2", - 'description': "petstore server", - 'variables': { - 'server': { - 'description': "No description provided", - 'default_value': "petstore", - 'enum_values': [ - "petstore", - "qa-petstore", - "dev-petstore" - ] - }, - 'port': { - 'description': "No description provided", - 'default_value': "80", - 'enum_values': [ - "80", - "8080" - ] - } - } - }, - { - 'url': "https://localhost:8080/{version}", - 'description': "The local server", - 'variables': { - 'version': { - 'description': "No description provided", - 'default_value': "v2", - 'enum_values': [ - "v1", - "v2" - ] - } - } - }, - { - 'url': "https://127.0.0.1/no_varaible", - 'description': "The local server without variables", - } - ] - - def get_host_from_settings(self, index, variables=None, servers=None): - """Gets host URL based on the index and variables - :param index: array index of the host settings - :param variables: hash of variable and the corresponding value - :param servers: an array of host settings or None - :return: URL based on host settings - """ - if index is None: - return self._base_path - - variables = {} if variables is None else variables - servers = self.get_host_settings() if servers is None else servers - - try: - server = servers[index] - except IndexError: - raise ValueError( - "Invalid index {0} when selecting the host settings. " - "Must be less than {1}".format(index, len(servers))) - - url = server['url'] - - # go through variables and replace placeholders - for variable_name, variable in server.get('variables', {}).items(): - used_value = variables.get( - variable_name, variable['default_value']) - - if 'enum_values' in variable \ - and used_value not in variable['enum_values']: - raise ValueError( - "The variable `{0}` in the host URL has invalid value " - "{1}. Must be {2}.".format( - variable_name, variables[variable_name], - variable['enum_values'])) - - url = url.replace("{" + variable_name + "}", used_value) - - return url - - @property - def host(self): - """Return generated host.""" - return self.get_host_from_settings(self.server_index, variables=self.server_variables) - - @host.setter - def host(self, value): - """Fix base path.""" - self._base_path = value - self.server_index = None diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/exceptions.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/exceptions.py deleted file mode 100644 index 6c4ae9c4e02f..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/exceptions.py +++ /dev/null @@ -1,166 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -class OpenApiException(Exception): - """The base exception class for all OpenAPIExceptions""" - - -class ApiTypeError(OpenApiException, TypeError): - def __init__(self, msg, path_to_item=None, valid_classes=None, - key_type=None) -> None: - """ Raises an exception for TypeErrors - - Args: - msg (str): the exception message - - Keyword Args: - path_to_item (list): a list of keys an indices to get to the - current_item - None if unset - valid_classes (tuple): the primitive classes that current item - should be an instance of - None if unset - key_type (bool): False if our value is a value in a dict - True if it is a key in a dict - False if our item is an item in a list - None if unset - """ - self.path_to_item = path_to_item - self.valid_classes = valid_classes - self.key_type = key_type - full_msg = msg - if path_to_item: - full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) - super(ApiTypeError, self).__init__(full_msg) - - -class ApiValueError(OpenApiException, ValueError): - def __init__(self, msg, path_to_item=None) -> None: - """ - Args: - msg (str): the exception message - - Keyword Args: - path_to_item (list) the path to the exception in the - received_data dict. None if unset - """ - - self.path_to_item = path_to_item - full_msg = msg - if path_to_item: - full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) - super(ApiValueError, self).__init__(full_msg) - - -class ApiAttributeError(OpenApiException, AttributeError): - def __init__(self, msg, path_to_item=None) -> None: - """ - Raised when an attribute reference or assignment fails. - - Args: - msg (str): the exception message - - Keyword Args: - path_to_item (None/list) the path to the exception in the - received_data dict - """ - self.path_to_item = path_to_item - full_msg = msg - if path_to_item: - full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) - super(ApiAttributeError, self).__init__(full_msg) - - -class ApiKeyError(OpenApiException, KeyError): - def __init__(self, msg, path_to_item=None) -> None: - """ - Args: - msg (str): the exception message - - Keyword Args: - path_to_item (None/list) the path to the exception in the - received_data dict - """ - self.path_to_item = path_to_item - full_msg = msg - if path_to_item: - full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) - super(ApiKeyError, self).__init__(full_msg) - - -class ApiException(OpenApiException): - - def __init__(self, status=None, reason=None, http_resp=None) -> None: - if http_resp: - self.status = http_resp.status - self.reason = http_resp.reason - self.body = http_resp.data - self.headers = http_resp.getheaders() - else: - self.status = status - self.reason = reason - self.body = None - self.headers = None - - def __str__(self): - """Custom error messages for exception""" - error_message = "({0})\n"\ - "Reason: {1}\n".format(self.status, self.reason) - if self.headers: - error_message += "HTTP response headers: {0}\n".format( - self.headers) - - if self.body: - error_message += "HTTP response body: {0}\n".format(self.body) - - return error_message - -class BadRequestException(ApiException): - - def __init__(self, status=None, reason=None, http_resp=None) -> None: - super(BadRequestException, self).__init__(status, reason, http_resp) - -class NotFoundException(ApiException): - - def __init__(self, status=None, reason=None, http_resp=None) -> None: - super(NotFoundException, self).__init__(status, reason, http_resp) - - -class UnauthorizedException(ApiException): - - def __init__(self, status=None, reason=None, http_resp=None) -> None: - super(UnauthorizedException, self).__init__(status, reason, http_resp) - - -class ForbiddenException(ApiException): - - def __init__(self, status=None, reason=None, http_resp=None) -> None: - super(ForbiddenException, self).__init__(status, reason, http_resp) - - -class ServiceException(ApiException): - - def __init__(self, status=None, reason=None, http_resp=None) -> None: - super(ServiceException, self).__init__(status, reason, http_resp) - - -def render_path(path_to_item): - """Returns a string representation of a path""" - result = "" - for pth in path_to_item: - if isinstance(pth, int): - result += "[{0}]".format(pth) - else: - result += "['{0}']".format(pth) - return result diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/__init__.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/__init__.py deleted file mode 100644 index e3ce5fa55384..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/__init__.py +++ /dev/null @@ -1,95 +0,0 @@ -# coding: utf-8 - -# flake8: noqa -""" - 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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -# import models into model package -from petstore_api.models.additional_properties_any_type import AdditionalPropertiesAnyType -from petstore_api.models.additional_properties_class import AdditionalPropertiesClass -from petstore_api.models.additional_properties_object import AdditionalPropertiesObject -from petstore_api.models.additional_properties_with_description_only import AdditionalPropertiesWithDescriptionOnly -from petstore_api.models.all_of_with_single_ref import AllOfWithSingleRef -from petstore_api.models.animal import Animal -from petstore_api.models.any_of_color import AnyOfColor -from petstore_api.models.any_of_pig import AnyOfPig -from petstore_api.models.api_response import ApiResponse -from petstore_api.models.array_of_array_of_model import ArrayOfArrayOfModel -from petstore_api.models.array_of_array_of_number_only import ArrayOfArrayOfNumberOnly -from petstore_api.models.array_of_number_only import ArrayOfNumberOnly -from petstore_api.models.array_test import ArrayTest -from petstore_api.models.basque_pig import BasquePig -from petstore_api.models.capitalization import Capitalization -from petstore_api.models.cat import Cat -from petstore_api.models.category import Category -from petstore_api.models.circular_reference_model import CircularReferenceModel -from petstore_api.models.class_model import ClassModel -from petstore_api.models.client import Client -from petstore_api.models.color import Color -from petstore_api.models.creature import Creature -from petstore_api.models.creature_info import CreatureInfo -from petstore_api.models.danish_pig import DanishPig -from petstore_api.models.deprecated_object import DeprecatedObject -from petstore_api.models.dog import Dog -from petstore_api.models.dummy_model import DummyModel -from petstore_api.models.enum_arrays import EnumArrays -from petstore_api.models.enum_class import EnumClass -from petstore_api.models.enum_string1 import EnumString1 -from petstore_api.models.enum_string2 import EnumString2 -from petstore_api.models.enum_test import EnumTest -from petstore_api.models.file import File -from petstore_api.models.file_schema_test_class import FileSchemaTestClass -from petstore_api.models.first_ref import FirstRef -from petstore_api.models.foo import Foo -from petstore_api.models.foo_get_default_response import FooGetDefaultResponse -from petstore_api.models.format_test import FormatTest -from petstore_api.models.has_only_read_only import HasOnlyReadOnly -from petstore_api.models.health_check_result import HealthCheckResult -from petstore_api.models.inner_dict_with_property import InnerDictWithProperty -from petstore_api.models.int_or_string import IntOrString -from petstore_api.models.list import List -from petstore_api.models.map_of_array_of_model import MapOfArrayOfModel -from petstore_api.models.map_test import MapTest -from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass -from petstore_api.models.model200_response import Model200Response -from petstore_api.models.model_return import ModelReturn -from petstore_api.models.name import Name -from petstore_api.models.nullable_class import NullableClass -from petstore_api.models.nullable_property import NullableProperty -from petstore_api.models.number_only import NumberOnly -from petstore_api.models.object_to_test_additional_properties import ObjectToTestAdditionalProperties -from petstore_api.models.object_with_deprecated_fields import ObjectWithDeprecatedFields -from petstore_api.models.one_of_enum_string import OneOfEnumString -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_enum_default_value import OuterEnumDefaultValue -from petstore_api.models.outer_enum_integer import OuterEnumInteger -from petstore_api.models.outer_enum_integer_default_value import OuterEnumIntegerDefaultValue -from petstore_api.models.outer_object_with_enum_property import OuterObjectWithEnumProperty -from petstore_api.models.parent import Parent -from petstore_api.models.parent_with_optional_dict import ParentWithOptionalDict -from petstore_api.models.pet import Pet -from petstore_api.models.pig import Pig -from petstore_api.models.property_name_collision import PropertyNameCollision -from petstore_api.models.read_only_first import ReadOnlyFirst -from petstore_api.models.second_ref import SecondRef -from petstore_api.models.self_reference_model import SelfReferenceModel -from petstore_api.models.single_ref_type import SingleRefType -from petstore_api.models.special_character_enum import SpecialCharacterEnum -from petstore_api.models.special_model_name import SpecialModelName -from petstore_api.models.special_name import SpecialName -from petstore_api.models.tag import Tag -from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest -from petstore_api.models.tiger import Tiger -from petstore_api.models.user import User -from petstore_api.models.with_nested_one_of import WithNestedOneOf diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/additional_properties_any_type.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/additional_properties_any_type.py deleted file mode 100644 index 0441dfd99e92..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/additional_properties_any_type.py +++ /dev/null @@ -1,83 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Optional -from pydantic import BaseModel, StrictStr - -class AdditionalPropertiesAnyType(BaseModel): - """ - AdditionalPropertiesAnyType - """ - name: Optional[StrictStr] = None - additional_properties: Dict[str, Any] = {} - __properties = ["name"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> AdditionalPropertiesAnyType: - """Create an instance of AdditionalPropertiesAnyType from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - "additional_properties" - }, - exclude_none=True) - # puts key-value pairs in additional_properties in the top level - if self.additional_properties is not None: - for _key, _value in self.additional_properties.items(): - _dict[_key] = _value - - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> AdditionalPropertiesAnyType: - """Create an instance of AdditionalPropertiesAnyType from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return AdditionalPropertiesAnyType.parse_obj(obj) - - _obj = AdditionalPropertiesAnyType.parse_obj({ - "name": obj.get("name") - }) - # store additional fields in additional_properties - for _key in obj.keys(): - if _key not in cls.__properties: - _obj.additional_properties[_key] = obj.get(_key) - - return _obj - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/additional_properties_class.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/additional_properties_class.py deleted file mode 100644 index c53af3e2ca67..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/additional_properties_class.py +++ /dev/null @@ -1,73 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Dict, Optional -from pydantic import BaseModel, StrictStr - -class AdditionalPropertiesClass(BaseModel): - """ - AdditionalPropertiesClass - """ - map_property: Optional[Dict[str, StrictStr]] = None - map_of_map_property: Optional[Dict[str, Dict[str, StrictStr]]] = None - __properties = ["map_property", "map_of_map_property"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> AdditionalPropertiesClass: - """Create an instance of AdditionalPropertiesClass from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> AdditionalPropertiesClass: - """Create an instance of AdditionalPropertiesClass from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return AdditionalPropertiesClass.parse_obj(obj) - - _obj = AdditionalPropertiesClass.parse_obj({ - "map_property": obj.get("map_property"), - "map_of_map_property": obj.get("map_of_map_property") - }) - return _obj - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/additional_properties_object.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/additional_properties_object.py deleted file mode 100644 index cff0e89b0568..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/additional_properties_object.py +++ /dev/null @@ -1,83 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Optional -from pydantic import BaseModel, StrictStr - -class AdditionalPropertiesObject(BaseModel): - """ - AdditionalPropertiesObject - """ - name: Optional[StrictStr] = None - additional_properties: Dict[str, Any] = {} - __properties = ["name"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> AdditionalPropertiesObject: - """Create an instance of AdditionalPropertiesObject from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - "additional_properties" - }, - exclude_none=True) - # puts key-value pairs in additional_properties in the top level - if self.additional_properties is not None: - for _key, _value in self.additional_properties.items(): - _dict[_key] = _value - - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> AdditionalPropertiesObject: - """Create an instance of AdditionalPropertiesObject from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return AdditionalPropertiesObject.parse_obj(obj) - - _obj = AdditionalPropertiesObject.parse_obj({ - "name": obj.get("name") - }) - # store additional fields in additional_properties - for _key in obj.keys(): - if _key not in cls.__properties: - _obj.additional_properties[_key] = obj.get(_key) - - return _obj - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/additional_properties_with_description_only.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/additional_properties_with_description_only.py deleted file mode 100644 index 17d6c461ed1b..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/additional_properties_with_description_only.py +++ /dev/null @@ -1,83 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Optional -from pydantic import BaseModel, StrictStr - -class AdditionalPropertiesWithDescriptionOnly(BaseModel): - """ - AdditionalPropertiesWithDescriptionOnly - """ - name: Optional[StrictStr] = None - additional_properties: Dict[str, Any] = {} - __properties = ["name"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> AdditionalPropertiesWithDescriptionOnly: - """Create an instance of AdditionalPropertiesWithDescriptionOnly from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - "additional_properties" - }, - exclude_none=True) - # puts key-value pairs in additional_properties in the top level - if self.additional_properties is not None: - for _key, _value in self.additional_properties.items(): - _dict[_key] = _value - - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> AdditionalPropertiesWithDescriptionOnly: - """Create an instance of AdditionalPropertiesWithDescriptionOnly from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return AdditionalPropertiesWithDescriptionOnly.parse_obj(obj) - - _obj = AdditionalPropertiesWithDescriptionOnly.parse_obj({ - "name": obj.get("name") - }) - # store additional fields in additional_properties - for _key in obj.keys(): - if _key not in cls.__properties: - _obj.additional_properties[_key] = obj.get(_key) - - return _obj - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/all_of_with_single_ref.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/all_of_with_single_ref.py deleted file mode 100644 index c5d066463f64..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/all_of_with_single_ref.py +++ /dev/null @@ -1,74 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr -from petstore_api.models.single_ref_type import SingleRefType - -class AllOfWithSingleRef(BaseModel): - """ - AllOfWithSingleRef - """ - username: Optional[StrictStr] = None - single_ref_type: Optional[SingleRefType] = Field(None, alias="SingleRefType") - __properties = ["username", "SingleRefType"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> AllOfWithSingleRef: - """Create an instance of AllOfWithSingleRef from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> AllOfWithSingleRef: - """Create an instance of AllOfWithSingleRef from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return AllOfWithSingleRef.parse_obj(obj) - - _obj = AllOfWithSingleRef.parse_obj({ - "username": obj.get("username"), - "single_ref_type": obj.get("SingleRefType") - }) - return _obj - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/animal.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/animal.py deleted file mode 100644 index 18738e6051bc..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/animal.py +++ /dev/null @@ -1,92 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Optional, Union -from pydantic import BaseModel, Field, StrictStr - -class Animal(BaseModel): - """ - Animal - """ - class_name: StrictStr = Field(..., alias="className") - color: Optional[StrictStr] = 'red' - __properties = ["className", "color"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - # JSON field name that stores the object type - __discriminator_property_name = 'className' - - # discriminator mappings - __discriminator_value_class_map = { - 'Cat': 'Cat', - 'Dog': 'Dog' - } - - @classmethod - def get_discriminator_value(cls, obj: dict) -> str: - """Returns the discriminator value (object type) of the data""" - discriminator_value = obj[cls.__discriminator_property_name] - if discriminator_value: - return cls.__discriminator_value_class_map.get(discriminator_value) - else: - return None - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Union(Cat, Dog): - """Create an instance of Animal from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> Union(Cat, Dog): - """Create an instance of Animal from a dict""" - # look up the object type based on discriminator mapping - object_type = cls.get_discriminator_value(obj) - if object_type: - klass = globals()[object_type] - return klass.from_dict(obj) - else: - raise ValueError("Animal failed to lookup discriminator value from " + - json.dumps(obj) + ". Discriminator property name: " + cls.__discriminator_property_name + - ", mapping: " + json.dumps(cls.__discriminator_value_class_map)) - -from petstore_api.models.cat import Cat -from petstore_api.models.dog import Dog -Animal.update_forward_refs() - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/any_of_color.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/any_of_color.py deleted file mode 100644 index b422650686fd..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/any_of_color.py +++ /dev/null @@ -1,155 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -from inspect import getfullargspec -import json -import pprint -import re # noqa: F401 - -from typing import List, Optional -from pydantic import BaseModel, Field, StrictStr, ValidationError, conint, conlist, constr, validator -from typing import Union, Any, List, TYPE_CHECKING -from pydantic import StrictStr, Field - -ANYOFCOLOR_ANY_OF_SCHEMAS = ["List[int]", "str"] - -class AnyOfColor(BaseModel): - """ - Any of RGB array, RGBA array, or hex string. - """ - - # data type: List[int] - anyof_schema_1_validator: Optional[conlist(conint(strict=True, le=255, ge=0), max_items=3, min_items=3)] = Field(None, description="RGB three element array with values 0-255.") - # data type: List[int] - anyof_schema_2_validator: Optional[conlist(conint(strict=True, le=255, ge=0), max_items=4, min_items=4)] = Field(None, description="RGBA four element array with values 0-255.") - # data type: str - anyof_schema_3_validator: Optional[constr(strict=True, max_length=7, min_length=7)] = Field(None, description="Hex color string, such as #00FF00.") - if TYPE_CHECKING: - actual_instance: Union[List[int], str] - else: - actual_instance: Any - any_of_schemas: List[str] = Field(ANYOFCOLOR_ANY_OF_SCHEMAS, const=True) - - class Config: - validate_assignment = True - - def __init__(self, *args, **kwargs) -> None: - if args: - if len(args) > 1: - raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") - if kwargs: - raise ValueError("If a position argument is used, keyword arguments cannot be used.") - super().__init__(actual_instance=args[0]) - else: - super().__init__(**kwargs) - - @validator('actual_instance') - def actual_instance_must_validate_anyof(cls, v): - instance = AnyOfColor.construct() - error_messages = [] - # validate data type: List[int] - try: - instance.anyof_schema_1_validator = v - return v - except (ValidationError, ValueError) as e: - error_messages.append(str(e)) - # validate data type: List[int] - try: - instance.anyof_schema_2_validator = v - return v - except (ValidationError, ValueError) as e: - error_messages.append(str(e)) - # validate data type: str - try: - instance.anyof_schema_3_validator = v - return v - except (ValidationError, ValueError) as e: - error_messages.append(str(e)) - if error_messages: - # no match - raise ValueError("No match found when setting the actual_instance in AnyOfColor with anyOf schemas: List[int], str. Details: " + ", ".join(error_messages)) - else: - return v - - @classmethod - def from_dict(cls, obj: dict) -> AnyOfColor: - return cls.from_json(json.dumps(obj)) - - @classmethod - def from_json(cls, json_str: str) -> AnyOfColor: - """Returns the object represented by the json string""" - instance = AnyOfColor.construct() - error_messages = [] - # deserialize data into List[int] - try: - # validation - instance.anyof_schema_1_validator = json.loads(json_str) - # assign value to actual_instance - instance.actual_instance = instance.anyof_schema_1_validator - return instance - except (ValidationError, ValueError) as e: - error_messages.append(str(e)) - # deserialize data into List[int] - try: - # validation - instance.anyof_schema_2_validator = json.loads(json_str) - # assign value to actual_instance - instance.actual_instance = instance.anyof_schema_2_validator - return instance - except (ValidationError, ValueError) as e: - error_messages.append(str(e)) - # deserialize data into str - try: - # validation - instance.anyof_schema_3_validator = json.loads(json_str) - # assign value to actual_instance - instance.actual_instance = instance.anyof_schema_3_validator - return instance - except (ValidationError, ValueError) as e: - error_messages.append(str(e)) - - if error_messages: - # no match - raise ValueError("No match found when deserializing the JSON string into AnyOfColor with anyOf schemas: List[int], str. Details: " + ", ".join(error_messages)) - else: - return instance - - def to_json(self) -> str: - """Returns the JSON representation of the actual instance""" - if self.actual_instance is None: - return "null" - - to_json = getattr(self.actual_instance, "to_json", None) - if callable(to_json): - return self.actual_instance.to_json() - else: - return json.dumps(self.actual_instance) - - def to_dict(self) -> dict: - """Returns the dict representation of the actual instance""" - if self.actual_instance is None: - return "null" - - to_json = getattr(self.actual_instance, "to_json", None) - if callable(to_json): - return self.actual_instance.to_dict() - else: - return json.dumps(self.actual_instance) - - def to_str(self) -> str: - """Returns the string representation of the actual instance""" - return pprint.pformat(self.dict()) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/any_of_pig.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/any_of_pig.py deleted file mode 100644 index 1254f6789a8c..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/any_of_pig.py +++ /dev/null @@ -1,134 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -from inspect import getfullargspec -import json -import pprint -import re # noqa: F401 - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr, ValidationError, validator -from petstore_api.models.basque_pig import BasquePig -from petstore_api.models.danish_pig import DanishPig -from typing import Union, Any, List, TYPE_CHECKING -from pydantic import StrictStr, Field - -ANYOFPIG_ANY_OF_SCHEMAS = ["BasquePig", "DanishPig"] - -class AnyOfPig(BaseModel): - """ - AnyOfPig - """ - - # data type: BasquePig - anyof_schema_1_validator: Optional[BasquePig] = None - # data type: DanishPig - anyof_schema_2_validator: Optional[DanishPig] = None - if TYPE_CHECKING: - actual_instance: Union[BasquePig, DanishPig] - else: - actual_instance: Any - any_of_schemas: List[str] = Field(ANYOFPIG_ANY_OF_SCHEMAS, const=True) - - class Config: - validate_assignment = True - - def __init__(self, *args, **kwargs) -> None: - if args: - if len(args) > 1: - raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") - if kwargs: - raise ValueError("If a position argument is used, keyword arguments cannot be used.") - super().__init__(actual_instance=args[0]) - else: - super().__init__(**kwargs) - - @validator('actual_instance') - def actual_instance_must_validate_anyof(cls, v): - instance = AnyOfPig.construct() - error_messages = [] - # validate data type: BasquePig - if not isinstance(v, BasquePig): - error_messages.append(f"Error! Input type `{type(v)}` is not `BasquePig`") - else: - return v - - # validate data type: DanishPig - if not isinstance(v, DanishPig): - error_messages.append(f"Error! Input type `{type(v)}` is not `DanishPig`") - else: - return v - - if error_messages: - # no match - raise ValueError("No match found when setting the actual_instance in AnyOfPig with anyOf schemas: BasquePig, DanishPig. Details: " + ", ".join(error_messages)) - else: - return v - - @classmethod - def from_dict(cls, obj: dict) -> AnyOfPig: - return cls.from_json(json.dumps(obj)) - - @classmethod - def from_json(cls, json_str: str) -> AnyOfPig: - """Returns the object represented by the json string""" - instance = AnyOfPig.construct() - error_messages = [] - # anyof_schema_1_validator: Optional[BasquePig] = None - try: - instance.actual_instance = BasquePig.from_json(json_str) - return instance - except (ValidationError, ValueError) as e: - error_messages.append(str(e)) - # anyof_schema_2_validator: Optional[DanishPig] = None - try: - instance.actual_instance = DanishPig.from_json(json_str) - return instance - except (ValidationError, ValueError) as e: - error_messages.append(str(e)) - - if error_messages: - # no match - raise ValueError("No match found when deserializing the JSON string into AnyOfPig with anyOf schemas: BasquePig, DanishPig. Details: " + ", ".join(error_messages)) - else: - return instance - - def to_json(self) -> str: - """Returns the JSON representation of the actual instance""" - if self.actual_instance is None: - return "null" - - to_json = getattr(self.actual_instance, "to_json", None) - if callable(to_json): - return self.actual_instance.to_json() - else: - return json.dumps(self.actual_instance) - - def to_dict(self) -> dict: - """Returns the dict representation of the actual instance""" - if self.actual_instance is None: - return "null" - - to_json = getattr(self.actual_instance, "to_json", None) - if callable(to_json): - return self.actual_instance.to_dict() - else: - return json.dumps(self.actual_instance) - - def to_str(self) -> str: - """Returns the string representation of the actual instance""" - return pprint.pformat(self.dict()) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/api_response.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/api_response.py deleted file mode 100644 index 2c58b8b9ccb8..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/api_response.py +++ /dev/null @@ -1,75 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Optional -from pydantic import BaseModel, StrictInt, StrictStr - -class ApiResponse(BaseModel): - """ - ApiResponse - """ - code: Optional[StrictInt] = None - type: Optional[StrictStr] = None - message: Optional[StrictStr] = None - __properties = ["code", "type", "message"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> ApiResponse: - """Create an instance of ApiResponse from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> ApiResponse: - """Create an instance of ApiResponse from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return ApiResponse.parse_obj(obj) - - _obj = ApiResponse.parse_obj({ - "code": obj.get("code"), - "type": obj.get("type"), - "message": obj.get("message") - }) - return _obj - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/array_of_array_of_model.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/array_of_array_of_model.py deleted file mode 100644 index 6f67b220ccf1..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/array_of_array_of_model.py +++ /dev/null @@ -1,84 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import List, Optional -from pydantic import BaseModel, conlist -from petstore_api.models.tag import Tag - -class ArrayOfArrayOfModel(BaseModel): - """ - ArrayOfArrayOfModel - """ - another_property: Optional[conlist(conlist(Tag))] = None - __properties = ["another_property"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> ArrayOfArrayOfModel: - """Create an instance of ArrayOfArrayOfModel from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - # override the default output from pydantic by calling `to_dict()` of each item in another_property (list of list) - _items = [] - if self.another_property: - for _item in self.another_property: - if _item: - _items.append( - [_inner_item.to_dict() for _inner_item in _item if _inner_item is not None] - ) - _dict['another_property'] = _items - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> ArrayOfArrayOfModel: - """Create an instance of ArrayOfArrayOfModel from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return ArrayOfArrayOfModel.parse_obj(obj) - - _obj = ArrayOfArrayOfModel.parse_obj({ - "another_property": [ - [Tag.from_dict(_inner_item) for _inner_item in _item] - for _item in obj.get("another_property") - ] if obj.get("another_property") is not None else None - }) - return _obj - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/array_of_array_of_number_only.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/array_of_array_of_number_only.py deleted file mode 100644 index 8ce909858b18..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/array_of_array_of_number_only.py +++ /dev/null @@ -1,71 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import List, Optional -from pydantic import BaseModel, Field, conlist - -class ArrayOfArrayOfNumberOnly(BaseModel): - """ - ArrayOfArrayOfNumberOnly - """ - array_array_number: Optional[conlist(conlist(float))] = Field(None, alias="ArrayArrayNumber") - __properties = ["ArrayArrayNumber"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> ArrayOfArrayOfNumberOnly: - """Create an instance of ArrayOfArrayOfNumberOnly from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> ArrayOfArrayOfNumberOnly: - """Create an instance of ArrayOfArrayOfNumberOnly from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return ArrayOfArrayOfNumberOnly.parse_obj(obj) - - _obj = ArrayOfArrayOfNumberOnly.parse_obj({ - "array_array_number": obj.get("ArrayArrayNumber") - }) - return _obj - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/array_of_number_only.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/array_of_number_only.py deleted file mode 100644 index 768ea5ef0baf..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/array_of_number_only.py +++ /dev/null @@ -1,71 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import List, Optional -from pydantic import BaseModel, Field, conlist - -class ArrayOfNumberOnly(BaseModel): - """ - ArrayOfNumberOnly - """ - array_number: Optional[conlist(float)] = Field(None, alias="ArrayNumber") - __properties = ["ArrayNumber"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> ArrayOfNumberOnly: - """Create an instance of ArrayOfNumberOnly from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> ArrayOfNumberOnly: - """Create an instance of ArrayOfNumberOnly from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return ArrayOfNumberOnly.parse_obj(obj) - - _obj = ArrayOfNumberOnly.parse_obj({ - "array_number": obj.get("ArrayNumber") - }) - return _obj - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/array_test.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/array_test.py deleted file mode 100644 index 8ec1a1ad67ef..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/array_test.py +++ /dev/null @@ -1,88 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import List, Optional -from pydantic import BaseModel, StrictInt, StrictStr, conlist -from petstore_api.models.read_only_first import ReadOnlyFirst - -class ArrayTest(BaseModel): - """ - ArrayTest - """ - array_of_string: Optional[conlist(StrictStr, max_items=3, min_items=0)] = None - array_array_of_integer: Optional[conlist(conlist(StrictInt))] = None - array_array_of_model: Optional[conlist(conlist(ReadOnlyFirst))] = None - __properties = ["array_of_string", "array_array_of_integer", "array_array_of_model"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> ArrayTest: - """Create an instance of ArrayTest from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - # override the default output from pydantic by calling `to_dict()` of each item in array_array_of_model (list of list) - _items = [] - if self.array_array_of_model: - for _item in self.array_array_of_model: - if _item: - _items.append( - [_inner_item.to_dict() for _inner_item in _item if _inner_item is not None] - ) - _dict['array_array_of_model'] = _items - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> ArrayTest: - """Create an instance of ArrayTest from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return ArrayTest.parse_obj(obj) - - _obj = ArrayTest.parse_obj({ - "array_of_string": obj.get("array_of_string"), - "array_array_of_integer": obj.get("array_array_of_integer"), - "array_array_of_model": [ - [ReadOnlyFirst.from_dict(_inner_item) for _inner_item in _item] - for _item in obj.get("array_array_of_model") - ] if obj.get("array_array_of_model") is not None else None - }) - return _obj - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/basque_pig.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/basque_pig.py deleted file mode 100644 index 5683a73a3bfc..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/basque_pig.py +++ /dev/null @@ -1,73 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - - -from pydantic import BaseModel, Field, StrictStr - -class BasquePig(BaseModel): - """ - BasquePig - """ - class_name: StrictStr = Field(..., alias="className") - color: StrictStr = Field(...) - __properties = ["className", "color"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> BasquePig: - """Create an instance of BasquePig from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> BasquePig: - """Create an instance of BasquePig from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return BasquePig.parse_obj(obj) - - _obj = BasquePig.parse_obj({ - "class_name": obj.get("className"), - "color": obj.get("color") - }) - return _obj - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/capitalization.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/capitalization.py deleted file mode 100644 index 2bb4435563b2..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/capitalization.py +++ /dev/null @@ -1,81 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr - -class Capitalization(BaseModel): - """ - Capitalization - """ - small_camel: Optional[StrictStr] = Field(None, alias="smallCamel") - capital_camel: Optional[StrictStr] = Field(None, alias="CapitalCamel") - small_snake: Optional[StrictStr] = Field(None, alias="small_Snake") - capital_snake: Optional[StrictStr] = Field(None, alias="Capital_Snake") - sca_eth_flow_points: Optional[StrictStr] = Field(None, alias="SCA_ETH_Flow_Points") - att_name: Optional[StrictStr] = Field(None, alias="ATT_NAME", description="Name of the pet ") - __properties = ["smallCamel", "CapitalCamel", "small_Snake", "Capital_Snake", "SCA_ETH_Flow_Points", "ATT_NAME"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Capitalization: - """Create an instance of Capitalization from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> Capitalization: - """Create an instance of Capitalization from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return Capitalization.parse_obj(obj) - - _obj = Capitalization.parse_obj({ - "small_camel": obj.get("smallCamel"), - "capital_camel": obj.get("CapitalCamel"), - "small_snake": obj.get("small_Snake"), - "capital_snake": obj.get("Capital_Snake"), - "sca_eth_flow_points": obj.get("SCA_ETH_Flow_Points"), - "att_name": obj.get("ATT_NAME") - }) - return _obj - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/cat.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/cat.py deleted file mode 100644 index efff0890a41a..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/cat.py +++ /dev/null @@ -1,74 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Optional -from pydantic import StrictBool -from petstore_api.models.animal import Animal - -class Cat(Animal): - """ - Cat - """ - declawed: Optional[StrictBool] = None - __properties = ["className", "color", "declawed"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Cat: - """Create an instance of Cat from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> Cat: - """Create an instance of Cat from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return Cat.parse_obj(obj) - - _obj = Cat.parse_obj({ - "class_name": obj.get("className"), - "color": obj.get("color") if obj.get("color") is not None else 'red', - "declawed": obj.get("declawed") - }) - return _obj - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/category.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/category.py deleted file mode 100644 index 86a10a8683cf..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/category.py +++ /dev/null @@ -1,73 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr - -class Category(BaseModel): - """ - Category - """ - id: Optional[StrictInt] = None - name: StrictStr = Field(...) - __properties = ["id", "name"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Category: - """Create an instance of Category from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> Category: - """Create an instance of Category from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return Category.parse_obj(obj) - - _obj = Category.parse_obj({ - "id": obj.get("id"), - "name": obj.get("name") if obj.get("name") is not None else 'default-name' - }) - return _obj - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/circular_reference_model.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/circular_reference_model.py deleted file mode 100644 index 6a9956f5af3b..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/circular_reference_model.py +++ /dev/null @@ -1,78 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Optional -from pydantic import BaseModel, StrictInt - -class CircularReferenceModel(BaseModel): - """ - CircularReferenceModel - """ - size: Optional[StrictInt] = None - nested: Optional[FirstRef] = None - __properties = ["size", "nested"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> CircularReferenceModel: - """Create an instance of CircularReferenceModel from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - # override the default output from pydantic by calling `to_dict()` of nested - if self.nested: - _dict['nested'] = self.nested.to_dict() - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> CircularReferenceModel: - """Create an instance of CircularReferenceModel from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return CircularReferenceModel.parse_obj(obj) - - _obj = CircularReferenceModel.parse_obj({ - "size": obj.get("size"), - "nested": FirstRef.from_dict(obj.get("nested")) if obj.get("nested") is not None else None - }) - return _obj - -from petstore_api.models.first_ref import FirstRef -CircularReferenceModel.update_forward_refs() - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/class_model.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/class_model.py deleted file mode 100644 index d345924958ee..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/class_model.py +++ /dev/null @@ -1,71 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr - -class ClassModel(BaseModel): - """ - Model for testing model with \"_class\" property # noqa: E501 - """ - var_class: Optional[StrictStr] = Field(None, alias="_class") - __properties = ["_class"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> ClassModel: - """Create an instance of ClassModel from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> ClassModel: - """Create an instance of ClassModel from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return ClassModel.parse_obj(obj) - - _obj = ClassModel.parse_obj({ - "var_class": obj.get("_class") - }) - return _obj - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/client.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/client.py deleted file mode 100644 index 01f60acef507..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/client.py +++ /dev/null @@ -1,71 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Optional -from pydantic import BaseModel, StrictStr - -class Client(BaseModel): - """ - Client - """ - client: Optional[StrictStr] = None - __properties = ["client"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Client: - """Create an instance of Client from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> Client: - """Create an instance of Client from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return Client.parse_obj(obj) - - _obj = Client.parse_obj({ - "client": obj.get("client") - }) - return _obj - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/color.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/color.py deleted file mode 100644 index 4dee9419ab7f..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/color.py +++ /dev/null @@ -1,170 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -from inspect import getfullargspec -import json -import pprint -import re # noqa: F401 - -from typing import Any, List, Optional -from pydantic import BaseModel, Field, StrictStr, ValidationError, conint, conlist, constr, validator -from typing import Union, Any, List, TYPE_CHECKING -from pydantic import StrictStr, Field - -COLOR_ONE_OF_SCHEMAS = ["List[int]", "str"] - -class Color(BaseModel): - """ - RGB array, RGBA array, or hex string. - """ - # data type: List[int] - oneof_schema_1_validator: Optional[conlist(conint(strict=True, le=255, ge=0), max_items=3, min_items=3)] = Field(None, description="RGB three element array with values 0-255.") - # data type: List[int] - oneof_schema_2_validator: Optional[conlist(conint(strict=True, le=255, ge=0), max_items=4, min_items=4)] = Field(None, description="RGBA four element array with values 0-255.") - # data type: str - oneof_schema_3_validator: Optional[constr(strict=True, max_length=7, min_length=7)] = Field(None, description="Hex color string, such as #00FF00.") - if TYPE_CHECKING: - actual_instance: Union[List[int], str] - else: - actual_instance: Any - one_of_schemas: List[str] = Field(COLOR_ONE_OF_SCHEMAS, const=True) - - class Config: - validate_assignment = True - - def __init__(self, *args, **kwargs) -> None: - if args: - if len(args) > 1: - raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") - if kwargs: - raise ValueError("If a position argument is used, keyword arguments cannot be used.") - super().__init__(actual_instance=args[0]) - else: - super().__init__(**kwargs) - - @validator('actual_instance') - def actual_instance_must_validate_oneof(cls, v): - if v is None: - return v - - instance = Color.construct() - error_messages = [] - match = 0 - # validate data type: List[int] - try: - instance.oneof_schema_1_validator = v - match += 1 - except (ValidationError, ValueError) as e: - error_messages.append(str(e)) - # validate data type: List[int] - try: - instance.oneof_schema_2_validator = v - match += 1 - except (ValidationError, ValueError) as e: - error_messages.append(str(e)) - # validate data type: str - try: - instance.oneof_schema_3_validator = v - match += 1 - except (ValidationError, ValueError) as e: - error_messages.append(str(e)) - if match > 1: - # more than 1 match - raise ValueError("Multiple matches found when setting `actual_instance` in Color with oneOf schemas: List[int], str. Details: " + ", ".join(error_messages)) - elif match == 0: - # no match - raise ValueError("No match found when setting `actual_instance` in Color with oneOf schemas: List[int], str. Details: " + ", ".join(error_messages)) - else: - return v - - @classmethod - def from_dict(cls, obj: dict) -> Color: - return cls.from_json(json.dumps(obj)) - - @classmethod - def from_json(cls, json_str: str) -> Color: - """Returns the object represented by the json string""" - instance = Color.construct() - if json_str is None: - return instance - - error_messages = [] - match = 0 - - # deserialize data into List[int] - try: - # validation - instance.oneof_schema_1_validator = json.loads(json_str) - # assign value to actual_instance - instance.actual_instance = instance.oneof_schema_1_validator - match += 1 - except (ValidationError, ValueError) as e: - error_messages.append(str(e)) - # deserialize data into List[int] - try: - # validation - instance.oneof_schema_2_validator = json.loads(json_str) - # assign value to actual_instance - instance.actual_instance = instance.oneof_schema_2_validator - match += 1 - except (ValidationError, ValueError) as e: - error_messages.append(str(e)) - # deserialize data into str - try: - # validation - instance.oneof_schema_3_validator = json.loads(json_str) - # assign value to actual_instance - instance.actual_instance = instance.oneof_schema_3_validator - match += 1 - except (ValidationError, ValueError) as e: - error_messages.append(str(e)) - - if match > 1: - # more than 1 match - raise ValueError("Multiple matches found when deserializing the JSON string into Color with oneOf schemas: List[int], str. Details: " + ", ".join(error_messages)) - elif match == 0: - # no match - raise ValueError("No match found when deserializing the JSON string into Color with oneOf schemas: List[int], str. Details: " + ", ".join(error_messages)) - else: - return instance - - def to_json(self) -> str: - """Returns the JSON representation of the actual instance""" - if self.actual_instance is None: - return "null" - - to_json = getattr(self.actual_instance, "to_json", None) - if callable(to_json): - return self.actual_instance.to_json() - else: - return json.dumps(self.actual_instance) - - def to_dict(self) -> dict: - """Returns the dict representation of the actual instance""" - if self.actual_instance is None: - return None - - to_dict = getattr(self.actual_instance, "to_dict", None) - if callable(to_dict): - return self.actual_instance.to_dict() - else: - # primitive type - return self.actual_instance - - def to_str(self) -> str: - """Returns the string representation of the actual instance""" - return pprint.pformat(self.dict()) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/creature.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/creature.py deleted file mode 100644 index dc2d94ece4cb..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/creature.py +++ /dev/null @@ -1,77 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - - -from pydantic import BaseModel, Field, StrictStr -from petstore_api.models.creature_info import CreatureInfo - -class Creature(BaseModel): - """ - Creature - """ - info: CreatureInfo = Field(...) - type: StrictStr = Field(...) - __properties = ["info", "type"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Creature: - """Create an instance of Creature from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - # override the default output from pydantic by calling `to_dict()` of info - if self.info: - _dict['info'] = self.info.to_dict() - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> Creature: - """Create an instance of Creature from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return Creature.parse_obj(obj) - - _obj = Creature.parse_obj({ - "info": CreatureInfo.from_dict(obj.get("info")) if obj.get("info") is not None else None, - "type": obj.get("type") - }) - return _obj - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/creature_info.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/creature_info.py deleted file mode 100644 index 327ce9bc4fbc..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/creature_info.py +++ /dev/null @@ -1,71 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - - -from pydantic import BaseModel, Field, StrictStr - -class CreatureInfo(BaseModel): - """ - CreatureInfo - """ - name: StrictStr = Field(...) - __properties = ["name"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> CreatureInfo: - """Create an instance of CreatureInfo from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> CreatureInfo: - """Create an instance of CreatureInfo from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return CreatureInfo.parse_obj(obj) - - _obj = CreatureInfo.parse_obj({ - "name": obj.get("name") - }) - return _obj - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/danish_pig.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/danish_pig.py deleted file mode 100644 index cfb24a7d5857..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/danish_pig.py +++ /dev/null @@ -1,73 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - - -from pydantic import BaseModel, Field, StrictInt, StrictStr - -class DanishPig(BaseModel): - """ - DanishPig - """ - class_name: StrictStr = Field(..., alias="className") - size: StrictInt = Field(...) - __properties = ["className", "size"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> DanishPig: - """Create an instance of DanishPig from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> DanishPig: - """Create an instance of DanishPig from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return DanishPig.parse_obj(obj) - - _obj = DanishPig.parse_obj({ - "class_name": obj.get("className"), - "size": obj.get("size") - }) - return _obj - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/deprecated_object.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/deprecated_object.py deleted file mode 100644 index 9ce72f88d48b..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/deprecated_object.py +++ /dev/null @@ -1,71 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Optional -from pydantic import BaseModel, StrictStr - -class DeprecatedObject(BaseModel): - """ - DeprecatedObject - """ - name: Optional[StrictStr] = None - __properties = ["name"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> DeprecatedObject: - """Create an instance of DeprecatedObject from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> DeprecatedObject: - """Create an instance of DeprecatedObject from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return DeprecatedObject.parse_obj(obj) - - _obj = DeprecatedObject.parse_obj({ - "name": obj.get("name") - }) - return _obj - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/dog.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/dog.py deleted file mode 100644 index f0533a50e495..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/dog.py +++ /dev/null @@ -1,74 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Optional -from pydantic import StrictStr -from petstore_api.models.animal import Animal - -class Dog(Animal): - """ - Dog - """ - breed: Optional[StrictStr] = None - __properties = ["className", "color", "breed"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Dog: - """Create an instance of Dog from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> Dog: - """Create an instance of Dog from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return Dog.parse_obj(obj) - - _obj = Dog.parse_obj({ - "class_name": obj.get("className"), - "color": obj.get("color") if obj.get("color") is not None else 'red', - "breed": obj.get("breed") - }) - return _obj - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/dummy_model.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/dummy_model.py deleted file mode 100644 index 8e4db12e5c92..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/dummy_model.py +++ /dev/null @@ -1,78 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Optional -from pydantic import BaseModel, StrictStr - -class DummyModel(BaseModel): - """ - DummyModel - """ - category: Optional[StrictStr] = None - self_ref: Optional[SelfReferenceModel] = None - __properties = ["category", "self_ref"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> DummyModel: - """Create an instance of DummyModel from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - # override the default output from pydantic by calling `to_dict()` of self_ref - if self.self_ref: - _dict['self_ref'] = self.self_ref.to_dict() - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> DummyModel: - """Create an instance of DummyModel from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return DummyModel.parse_obj(obj) - - _obj = DummyModel.parse_obj({ - "category": obj.get("category"), - "self_ref": SelfReferenceModel.from_dict(obj.get("self_ref")) if obj.get("self_ref") is not None else None - }) - return _obj - -from petstore_api.models.self_reference_model import SelfReferenceModel -DummyModel.update_forward_refs() - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/enum_arrays.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/enum_arrays.py deleted file mode 100644 index 5f3363b0a564..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/enum_arrays.py +++ /dev/null @@ -1,94 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import List, Optional -from pydantic import BaseModel, StrictStr, conlist, validator - -class EnumArrays(BaseModel): - """ - EnumArrays - """ - just_symbol: Optional[StrictStr] = None - array_enum: Optional[conlist(StrictStr)] = None - __properties = ["just_symbol", "array_enum"] - - @validator('just_symbol') - def just_symbol_validate_enum(cls, value): - """Validates the enum""" - if value is None: - return value - - if value not in ('>=', '$'): - raise ValueError("must be one of enum values ('>=', '$')") - return value - - @validator('array_enum') - def array_enum_validate_enum(cls, value): - """Validates the enum""" - if value is None: - return value - - for i in value: - if i not in ('fish', 'crab'): - raise ValueError("each list item must be one of ('fish', 'crab')") - return value - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> EnumArrays: - """Create an instance of EnumArrays from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> EnumArrays: - """Create an instance of EnumArrays from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return EnumArrays.parse_obj(obj) - - _obj = EnumArrays.parse_obj({ - "just_symbol": obj.get("just_symbol"), - "array_enum": obj.get("array_enum") - }) - return _obj - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/enum_class.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/enum_class.py deleted file mode 100644 index f3037885ed67..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/enum_class.py +++ /dev/null @@ -1,41 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import json -import pprint -import re # noqa: F401 -from aenum import Enum, no_arg - - - - - -class EnumClass(str, Enum): - """ - EnumClass - """ - - """ - allowed enum values - """ - ABC = '_abc' - MINUS_EFG = '-efg' - LEFT_PARENTHESIS_XYZ_RIGHT_PARENTHESIS = '(xyz)' - - @classmethod - def from_json(cls, json_str: str) -> EnumClass: - """Create an instance of EnumClass from a JSON string""" - return EnumClass(json.loads(json_str)) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/enum_string1.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/enum_string1.py deleted file mode 100644 index 8ced7d15629a..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/enum_string1.py +++ /dev/null @@ -1,40 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import json -import pprint -import re # noqa: F401 -from aenum import Enum, no_arg - - - - - -class EnumString1(str, Enum): - """ - EnumString1 - """ - - """ - allowed enum values - """ - A = 'a' - B = 'b' - - @classmethod - def from_json(cls, json_str: str) -> EnumString1: - """Create an instance of EnumString1 from a JSON string""" - return EnumString1(json.loads(json_str)) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/enum_string2.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/enum_string2.py deleted file mode 100644 index 1ee338109101..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/enum_string2.py +++ /dev/null @@ -1,40 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import json -import pprint -import re # noqa: F401 -from aenum import Enum, no_arg - - - - - -class EnumString2(str, Enum): - """ - EnumString2 - """ - - """ - allowed enum values - """ - C = 'c' - D = 'd' - - @classmethod - def from_json(cls, json_str: str) -> EnumString2: - """Create an instance of EnumString2 from a JSON string""" - return EnumString2(json.loads(json_str)) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/enum_test.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/enum_test.py deleted file mode 100644 index b3899720fd30..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/enum_test.py +++ /dev/null @@ -1,143 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr, validator -from petstore_api.models.outer_enum import OuterEnum -from petstore_api.models.outer_enum_default_value import OuterEnumDefaultValue -from petstore_api.models.outer_enum_integer import OuterEnumInteger -from petstore_api.models.outer_enum_integer_default_value import OuterEnumIntegerDefaultValue - -class EnumTest(BaseModel): - """ - EnumTest - """ - enum_string: Optional[StrictStr] = None - enum_string_required: StrictStr = Field(...) - enum_integer_default: Optional[StrictInt] = 5 - enum_integer: Optional[StrictInt] = None - enum_number: Optional[float] = None - outer_enum: Optional[OuterEnum] = Field(None, alias="outerEnum") - outer_enum_integer: Optional[OuterEnumInteger] = Field(None, alias="outerEnumInteger") - outer_enum_default_value: Optional[OuterEnumDefaultValue] = Field(None, alias="outerEnumDefaultValue") - outer_enum_integer_default_value: Optional[OuterEnumIntegerDefaultValue] = Field(None, alias="outerEnumIntegerDefaultValue") - __properties = ["enum_string", "enum_string_required", "enum_integer_default", "enum_integer", "enum_number", "outerEnum", "outerEnumInteger", "outerEnumDefaultValue", "outerEnumIntegerDefaultValue"] - - @validator('enum_string') - def enum_string_validate_enum(cls, value): - """Validates the enum""" - if value is None: - return value - - if value not in ('UPPER', 'lower', ''): - raise ValueError("must be one of enum values ('UPPER', 'lower', '')") - return value - - @validator('enum_string_required') - def enum_string_required_validate_enum(cls, value): - """Validates the enum""" - if value not in ('UPPER', 'lower', ''): - raise ValueError("must be one of enum values ('UPPER', 'lower', '')") - return value - - @validator('enum_integer_default') - def enum_integer_default_validate_enum(cls, value): - """Validates the enum""" - if value is None: - return value - - if value not in (1, 5, 14): - raise ValueError("must be one of enum values (1, 5, 14)") - return value - - @validator('enum_integer') - def enum_integer_validate_enum(cls, value): - """Validates the enum""" - if value is None: - return value - - if value not in (1, -1): - raise ValueError("must be one of enum values (1, -1)") - return value - - @validator('enum_number') - def enum_number_validate_enum(cls, value): - """Validates the enum""" - if value is None: - return value - - if value not in (1.1, -1.2): - raise ValueError("must be one of enum values (1.1, -1.2)") - return value - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> EnumTest: - """Create an instance of EnumTest from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - # set to None if outer_enum (nullable) is None - # and __fields_set__ contains the field - if self.outer_enum is None and "outer_enum" in self.__fields_set__: - _dict['outerEnum'] = None - - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> EnumTest: - """Create an instance of EnumTest from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return EnumTest.parse_obj(obj) - - _obj = EnumTest.parse_obj({ - "enum_string": obj.get("enum_string"), - "enum_string_required": obj.get("enum_string_required"), - "enum_integer_default": obj.get("enum_integer_default") if obj.get("enum_integer_default") is not None else 5, - "enum_integer": obj.get("enum_integer"), - "enum_number": obj.get("enum_number"), - "outer_enum": obj.get("outerEnum"), - "outer_enum_integer": obj.get("outerEnumInteger"), - "outer_enum_default_value": obj.get("outerEnumDefaultValue"), - "outer_enum_integer_default_value": obj.get("outerEnumIntegerDefaultValue") - }) - return _obj - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/file.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/file.py deleted file mode 100644 index c87e30f73bf2..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/file.py +++ /dev/null @@ -1,71 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr - -class File(BaseModel): - """ - Must be named `File` for test. # noqa: E501 - """ - source_uri: Optional[StrictStr] = Field(None, alias="sourceURI", description="Test capitalization") - __properties = ["sourceURI"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> File: - """Create an instance of File from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> File: - """Create an instance of File from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return File.parse_obj(obj) - - _obj = File.parse_obj({ - "source_uri": obj.get("sourceURI") - }) - return _obj - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/file_schema_test_class.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/file_schema_test_class.py deleted file mode 100644 index 32058bd16fa0..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/file_schema_test_class.py +++ /dev/null @@ -1,84 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import List, Optional -from pydantic import BaseModel, conlist -from petstore_api.models.file import File - -class FileSchemaTestClass(BaseModel): - """ - FileSchemaTestClass - """ - file: Optional[File] = None - files: Optional[conlist(File)] = None - __properties = ["file", "files"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> FileSchemaTestClass: - """Create an instance of FileSchemaTestClass from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - # override the default output from pydantic by calling `to_dict()` of file - if self.file: - _dict['file'] = self.file.to_dict() - # override the default output from pydantic by calling `to_dict()` of each item in files (list) - _items = [] - if self.files: - for _item in self.files: - if _item: - _items.append(_item.to_dict()) - _dict['files'] = _items - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> FileSchemaTestClass: - """Create an instance of FileSchemaTestClass from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return FileSchemaTestClass.parse_obj(obj) - - _obj = FileSchemaTestClass.parse_obj({ - "file": File.from_dict(obj.get("file")) if obj.get("file") is not None else None, - "files": [File.from_dict(_item) for _item in obj.get("files")] if obj.get("files") is not None else None - }) - return _obj - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/first_ref.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/first_ref.py deleted file mode 100644 index ace84a5bcb84..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/first_ref.py +++ /dev/null @@ -1,78 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Optional -from pydantic import BaseModel, StrictStr - -class FirstRef(BaseModel): - """ - FirstRef - """ - category: Optional[StrictStr] = None - self_ref: Optional[SecondRef] = None - __properties = ["category", "self_ref"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> FirstRef: - """Create an instance of FirstRef from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - # override the default output from pydantic by calling `to_dict()` of self_ref - if self.self_ref: - _dict['self_ref'] = self.self_ref.to_dict() - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> FirstRef: - """Create an instance of FirstRef from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return FirstRef.parse_obj(obj) - - _obj = FirstRef.parse_obj({ - "category": obj.get("category"), - "self_ref": SecondRef.from_dict(obj.get("self_ref")) if obj.get("self_ref") is not None else None - }) - return _obj - -from petstore_api.models.second_ref import SecondRef -FirstRef.update_forward_refs() - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/foo.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/foo.py deleted file mode 100644 index fc58b159e5f5..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/foo.py +++ /dev/null @@ -1,71 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Optional -from pydantic import BaseModel, StrictStr - -class Foo(BaseModel): - """ - Foo - """ - bar: Optional[StrictStr] = 'bar' - __properties = ["bar"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Foo: - """Create an instance of Foo from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> Foo: - """Create an instance of Foo from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return Foo.parse_obj(obj) - - _obj = Foo.parse_obj({ - "bar": obj.get("bar") if obj.get("bar") is not None else 'bar' - }) - return _obj - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/foo_get_default_response.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/foo_get_default_response.py deleted file mode 100644 index e792358dc002..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/foo_get_default_response.py +++ /dev/null @@ -1,75 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Optional -from pydantic import BaseModel -from petstore_api.models.foo import Foo - -class FooGetDefaultResponse(BaseModel): - """ - FooGetDefaultResponse - """ - string: Optional[Foo] = None - __properties = ["string"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> FooGetDefaultResponse: - """Create an instance of FooGetDefaultResponse from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - # override the default output from pydantic by calling `to_dict()` of string - if self.string: - _dict['string'] = self.string.to_dict() - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> FooGetDefaultResponse: - """Create an instance of FooGetDefaultResponse from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return FooGetDefaultResponse.parse_obj(obj) - - _obj = FooGetDefaultResponse.parse_obj({ - "string": Foo.from_dict(obj.get("string")) if obj.get("string") is not None else None - }) - return _obj - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/format_test.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/format_test.py deleted file mode 100644 index a0abc32a6598..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/format_test.py +++ /dev/null @@ -1,143 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - -from datetime import date, datetime -from typing import Optional, Union -from pydantic import BaseModel, Field, StrictBytes, StrictInt, StrictStr, condecimal, confloat, conint, constr, validator - -class FormatTest(BaseModel): - """ - FormatTest - """ - integer: Optional[conint(strict=True, le=100, ge=10)] = None - int32: Optional[conint(strict=True, le=200, ge=20)] = None - int64: Optional[StrictInt] = None - number: confloat(le=543.2, ge=32.1) = Field(...) - float: Optional[confloat(le=987.6, ge=54.3)] = None - double: Optional[confloat(le=123.4, ge=67.8)] = None - decimal: Optional[condecimal()] = None - string: Optional[constr(strict=True)] = None - string_with_double_quote_pattern: Optional[constr(strict=True)] = None - byte: Optional[Union[StrictBytes, StrictStr]] = None - binary: Optional[Union[StrictBytes, StrictStr]] = None - var_date: date = Field(..., alias="date") - date_time: Optional[datetime] = Field(None, alias="dateTime") - uuid: Optional[StrictStr] = None - password: constr(strict=True, max_length=64, min_length=10) = Field(...) - pattern_with_digits: Optional[constr(strict=True)] = Field(None, description="A string that is a 10 digit number. Can have leading zeros.") - pattern_with_digits_and_delimiter: Optional[constr(strict=True)] = Field(None, description="A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01.") - __properties = ["integer", "int32", "int64", "number", "float", "double", "decimal", "string", "string_with_double_quote_pattern", "byte", "binary", "date", "dateTime", "uuid", "password", "pattern_with_digits", "pattern_with_digits_and_delimiter"] - - @validator('string') - def string_validate_regular_expression(cls, value): - """Validates the regular expression""" - if value is None: - return value - - if not re.match(r"[a-z]", value ,re.IGNORECASE): - raise ValueError(r"must validate the regular expression /[a-z]/i") - return value - - @validator('string_with_double_quote_pattern') - def string_with_double_quote_pattern_validate_regular_expression(cls, value): - """Validates the regular expression""" - if value is None: - return value - - if not re.match(r"this is \"something\"", value): - raise ValueError(r"must validate the regular expression /this is \"something\"/") - return value - - @validator('pattern_with_digits') - def pattern_with_digits_validate_regular_expression(cls, value): - """Validates the regular expression""" - if value is None: - return value - - if not re.match(r"^\d{10}$", value): - raise ValueError(r"must validate the regular expression /^\d{10}$/") - return value - - @validator('pattern_with_digits_and_delimiter') - def pattern_with_digits_and_delimiter_validate_regular_expression(cls, value): - """Validates the regular expression""" - if value is None: - return value - - if not re.match(r"^image_\d{1,3}$", value ,re.IGNORECASE): - raise ValueError(r"must validate the regular expression /^image_\d{1,3}$/i") - return value - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> FormatTest: - """Create an instance of FormatTest from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> FormatTest: - """Create an instance of FormatTest from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return FormatTest.parse_obj(obj) - - _obj = FormatTest.parse_obj({ - "integer": obj.get("integer"), - "int32": obj.get("int32"), - "int64": obj.get("int64"), - "number": obj.get("number"), - "float": obj.get("float"), - "double": obj.get("double"), - "decimal": obj.get("decimal"), - "string": obj.get("string"), - "string_with_double_quote_pattern": obj.get("string_with_double_quote_pattern"), - "byte": obj.get("byte"), - "binary": obj.get("binary"), - "var_date": obj.get("date"), - "date_time": obj.get("dateTime"), - "uuid": obj.get("uuid"), - "password": obj.get("password"), - "pattern_with_digits": obj.get("pattern_with_digits"), - "pattern_with_digits_and_delimiter": obj.get("pattern_with_digits_and_delimiter") - }) - return _obj - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/has_only_read_only.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/has_only_read_only.py deleted file mode 100644 index 5a6dd7857d12..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/has_only_read_only.py +++ /dev/null @@ -1,75 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Optional -from pydantic import BaseModel, StrictStr - -class HasOnlyReadOnly(BaseModel): - """ - HasOnlyReadOnly - """ - bar: Optional[StrictStr] = None - foo: Optional[StrictStr] = None - __properties = ["bar", "foo"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> HasOnlyReadOnly: - """Create an instance of HasOnlyReadOnly from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - "bar", - "foo", - }, - exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> HasOnlyReadOnly: - """Create an instance of HasOnlyReadOnly from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return HasOnlyReadOnly.parse_obj(obj) - - _obj = HasOnlyReadOnly.parse_obj({ - "bar": obj.get("bar"), - "foo": obj.get("foo") - }) - return _obj - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/health_check_result.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/health_check_result.py deleted file mode 100644 index 02405bea384e..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/health_check_result.py +++ /dev/null @@ -1,76 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr - -class HealthCheckResult(BaseModel): - """ - Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. # noqa: E501 - """ - nullable_message: Optional[StrictStr] = Field(None, alias="NullableMessage") - __properties = ["NullableMessage"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> HealthCheckResult: - """Create an instance of HealthCheckResult from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - # set to None if nullable_message (nullable) is None - # and __fields_set__ contains the field - if self.nullable_message is None and "nullable_message" in self.__fields_set__: - _dict['NullableMessage'] = None - - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> HealthCheckResult: - """Create an instance of HealthCheckResult from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return HealthCheckResult.parse_obj(obj) - - _obj = HealthCheckResult.parse_obj({ - "nullable_message": obj.get("NullableMessage") - }) - return _obj - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/inner_dict_with_property.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/inner_dict_with_property.py deleted file mode 100644 index 9f134186b6a6..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/inner_dict_with_property.py +++ /dev/null @@ -1,71 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Any, Dict, Optional -from pydantic import BaseModel, Field - -class InnerDictWithProperty(BaseModel): - """ - InnerDictWithProperty - """ - a_property: Optional[Dict[str, Any]] = Field(None, alias="aProperty") - __properties = ["aProperty"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> InnerDictWithProperty: - """Create an instance of InnerDictWithProperty from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> InnerDictWithProperty: - """Create an instance of InnerDictWithProperty from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return InnerDictWithProperty.parse_obj(obj) - - _obj = InnerDictWithProperty.parse_obj({ - "a_property": obj.get("aProperty") - }) - return _obj - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/int_or_string.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/int_or_string.py deleted file mode 100644 index 5d5de47e305a..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/int_or_string.py +++ /dev/null @@ -1,147 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -from inspect import getfullargspec -import json -import pprint -import re # noqa: F401 - -from typing import Any, List, Optional -from pydantic import BaseModel, Field, StrictStr, ValidationError, conint, validator -from typing import Union, Any, List, TYPE_CHECKING -from pydantic import StrictStr, Field - -INTORSTRING_ONE_OF_SCHEMAS = ["int", "str"] - -class IntOrString(BaseModel): - """ - IntOrString - """ - # data type: int - oneof_schema_1_validator: Optional[conint(strict=True, ge=10)] = None - # data type: str - oneof_schema_2_validator: Optional[StrictStr] = None - if TYPE_CHECKING: - actual_instance: Union[int, str] - else: - actual_instance: Any - one_of_schemas: List[str] = Field(INTORSTRING_ONE_OF_SCHEMAS, const=True) - - class Config: - validate_assignment = True - - def __init__(self, *args, **kwargs) -> None: - if args: - if len(args) > 1: - raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") - if kwargs: - raise ValueError("If a position argument is used, keyword arguments cannot be used.") - super().__init__(actual_instance=args[0]) - else: - super().__init__(**kwargs) - - @validator('actual_instance') - def actual_instance_must_validate_oneof(cls, v): - instance = IntOrString.construct() - error_messages = [] - match = 0 - # validate data type: int - try: - instance.oneof_schema_1_validator = v - match += 1 - except (ValidationError, ValueError) as e: - error_messages.append(str(e)) - # validate data type: str - try: - instance.oneof_schema_2_validator = v - match += 1 - except (ValidationError, ValueError) as e: - error_messages.append(str(e)) - if match > 1: - # more than 1 match - raise ValueError("Multiple matches found when setting `actual_instance` in IntOrString with oneOf schemas: int, str. Details: " + ", ".join(error_messages)) - elif match == 0: - # no match - raise ValueError("No match found when setting `actual_instance` in IntOrString with oneOf schemas: int, str. Details: " + ", ".join(error_messages)) - else: - return v - - @classmethod - def from_dict(cls, obj: dict) -> IntOrString: - return cls.from_json(json.dumps(obj)) - - @classmethod - def from_json(cls, json_str: str) -> IntOrString: - """Returns the object represented by the json string""" - instance = IntOrString.construct() - error_messages = [] - match = 0 - - # deserialize data into int - try: - # validation - instance.oneof_schema_1_validator = json.loads(json_str) - # assign value to actual_instance - instance.actual_instance = instance.oneof_schema_1_validator - match += 1 - except (ValidationError, ValueError) as e: - error_messages.append(str(e)) - # deserialize data into str - try: - # validation - instance.oneof_schema_2_validator = json.loads(json_str) - # assign value to actual_instance - instance.actual_instance = instance.oneof_schema_2_validator - match += 1 - except (ValidationError, ValueError) as e: - error_messages.append(str(e)) - - if match > 1: - # more than 1 match - raise ValueError("Multiple matches found when deserializing the JSON string into IntOrString with oneOf schemas: int, str. Details: " + ", ".join(error_messages)) - elif match == 0: - # no match - raise ValueError("No match found when deserializing the JSON string into IntOrString with oneOf schemas: int, str. Details: " + ", ".join(error_messages)) - else: - return instance - - def to_json(self) -> str: - """Returns the JSON representation of the actual instance""" - if self.actual_instance is None: - return "null" - - to_json = getattr(self.actual_instance, "to_json", None) - if callable(to_json): - return self.actual_instance.to_json() - else: - return json.dumps(self.actual_instance) - - def to_dict(self) -> dict: - """Returns the dict representation of the actual instance""" - if self.actual_instance is None: - return None - - to_dict = getattr(self.actual_instance, "to_dict", None) - if callable(to_dict): - return self.actual_instance.to_dict() - else: - # primitive type - return self.actual_instance - - def to_str(self) -> str: - """Returns the string representation of the actual instance""" - return pprint.pformat(self.dict()) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/list.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/list.py deleted file mode 100644 index 4c6868146ad0..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/list.py +++ /dev/null @@ -1,71 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr - -class List(BaseModel): - """ - List - """ - var_123_list: Optional[StrictStr] = Field(None, alias="123-list") - __properties = ["123-list"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> List: - """Create an instance of List from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> List: - """Create an instance of List from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return List.parse_obj(obj) - - _obj = List.parse_obj({ - "var_123_list": obj.get("123-list") - }) - return _obj - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/map_of_array_of_model.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/map_of_array_of_model.py deleted file mode 100644 index 444732620ab5..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/map_of_array_of_model.py +++ /dev/null @@ -1,88 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Dict, List, Optional -from pydantic import BaseModel, Field, conlist -from petstore_api.models.tag import Tag - -class MapOfArrayOfModel(BaseModel): - """ - MapOfArrayOfModel - """ - shop_id_to_org_online_lip_map: Optional[Dict[str, conlist(Tag)]] = Field(None, alias="shopIdToOrgOnlineLipMap") - __properties = ["shopIdToOrgOnlineLipMap"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> MapOfArrayOfModel: - """Create an instance of MapOfArrayOfModel from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - # override the default output from pydantic by calling `to_dict()` of each value in shop_id_to_org_online_lip_map (dict of array) - _field_dict_of_array = {} - if self.shop_id_to_org_online_lip_map: - for _key in self.shop_id_to_org_online_lip_map: - if self.shop_id_to_org_online_lip_map[_key]: - _field_dict_of_array[_key] = [ - _item.to_dict() for _item in self.shop_id_to_org_online_lip_map[_key] - ] - _dict['shopIdToOrgOnlineLipMap'] = _field_dict_of_array - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> MapOfArrayOfModel: - """Create an instance of MapOfArrayOfModel from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return MapOfArrayOfModel.parse_obj(obj) - - _obj = MapOfArrayOfModel.parse_obj({ - "shop_id_to_org_online_lip_map": dict( - (_k, - [Tag.from_dict(_item) for _item in _v] - if _v is not None - else None - ) - for _k, _v in obj.get("shopIdToOrgOnlineLipMap").items() - ) - }) - return _obj - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/map_test.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/map_test.py deleted file mode 100644 index 42e47b1cb4f3..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/map_test.py +++ /dev/null @@ -1,87 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Dict, Optional -from pydantic import BaseModel, StrictBool, StrictStr, validator - -class MapTest(BaseModel): - """ - MapTest - """ - map_map_of_string: Optional[Dict[str, Dict[str, StrictStr]]] = None - map_of_enum_string: Optional[Dict[str, StrictStr]] = None - direct_map: Optional[Dict[str, StrictBool]] = None - indirect_map: Optional[Dict[str, StrictBool]] = None - __properties = ["map_map_of_string", "map_of_enum_string", "direct_map", "indirect_map"] - - @validator('map_of_enum_string') - def map_of_enum_string_validate_enum(cls, value): - """Validates the enum""" - if value is None: - return value - - if value not in ('UPPER', 'lower'): - raise ValueError("must be one of enum values ('UPPER', 'lower')") - return value - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> MapTest: - """Create an instance of MapTest from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> MapTest: - """Create an instance of MapTest from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return MapTest.parse_obj(obj) - - _obj = MapTest.parse_obj({ - "map_map_of_string": obj.get("map_map_of_string"), - "map_of_enum_string": obj.get("map_of_enum_string"), - "direct_map": obj.get("direct_map"), - "indirect_map": obj.get("indirect_map") - }) - return _obj - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/mixed_properties_and_additional_properties_class.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/mixed_properties_and_additional_properties_class.py deleted file mode 100644 index 03f306af535f..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/mixed_properties_and_additional_properties_class.py +++ /dev/null @@ -1,88 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - -from datetime import datetime -from typing import Dict, Optional -from pydantic import BaseModel, Field, StrictStr -from petstore_api.models.animal import Animal - -class MixedPropertiesAndAdditionalPropertiesClass(BaseModel): - """ - MixedPropertiesAndAdditionalPropertiesClass - """ - uuid: Optional[StrictStr] = None - date_time: Optional[datetime] = Field(None, alias="dateTime") - map: Optional[Dict[str, Animal]] = None - __properties = ["uuid", "dateTime", "map"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> MixedPropertiesAndAdditionalPropertiesClass: - """Create an instance of MixedPropertiesAndAdditionalPropertiesClass from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - # override the default output from pydantic by calling `to_dict()` of each value in map (dict) - _field_dict = {} - if self.map: - for _key in self.map: - if self.map[_key]: - _field_dict[_key] = self.map[_key].to_dict() - _dict['map'] = _field_dict - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> MixedPropertiesAndAdditionalPropertiesClass: - """Create an instance of MixedPropertiesAndAdditionalPropertiesClass from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return MixedPropertiesAndAdditionalPropertiesClass.parse_obj(obj) - - _obj = MixedPropertiesAndAdditionalPropertiesClass.parse_obj({ - "uuid": obj.get("uuid"), - "date_time": obj.get("dateTime"), - "map": dict( - (_k, Animal.from_dict(_v)) - for _k, _v in obj.get("map").items() - ) - if obj.get("map") is not None - else None - }) - return _obj - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/model200_response.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/model200_response.py deleted file mode 100644 index f129e4dafe80..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/model200_response.py +++ /dev/null @@ -1,73 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr - -class Model200Response(BaseModel): - """ - Model for testing model name starting with number # noqa: E501 - """ - name: Optional[StrictInt] = None - var_class: Optional[StrictStr] = Field(None, alias="class") - __properties = ["name", "class"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Model200Response: - """Create an instance of Model200Response from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> Model200Response: - """Create an instance of Model200Response from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return Model200Response.parse_obj(obj) - - _obj = Model200Response.parse_obj({ - "name": obj.get("name"), - "var_class": obj.get("class") - }) - return _obj - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/model_return.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/model_return.py deleted file mode 100644 index 1d2b0266d343..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/model_return.py +++ /dev/null @@ -1,71 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Optional -from pydantic import BaseModel, Field, StrictInt - -class ModelReturn(BaseModel): - """ - Model for testing reserved words # noqa: E501 - """ - var_return: Optional[StrictInt] = Field(None, alias="return") - __properties = ["return"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> ModelReturn: - """Create an instance of ModelReturn from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> ModelReturn: - """Create an instance of ModelReturn from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return ModelReturn.parse_obj(obj) - - _obj = ModelReturn.parse_obj({ - "var_return": obj.get("return") - }) - return _obj - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/name.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/name.py deleted file mode 100644 index 5284db112e9b..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/name.py +++ /dev/null @@ -1,79 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr - -class Name(BaseModel): - """ - Model for testing model name same as property name # noqa: E501 - """ - name: StrictInt = Field(...) - snake_case: Optional[StrictInt] = None - var_property: Optional[StrictStr] = Field(None, alias="property") - var_123_number: Optional[StrictInt] = Field(None, alias="123Number") - __properties = ["name", "snake_case", "property", "123Number"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Name: - """Create an instance of Name from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - "snake_case", - "var_123_number", - }, - exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> Name: - """Create an instance of Name from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return Name.parse_obj(obj) - - _obj = Name.parse_obj({ - "name": obj.get("name"), - "snake_case": obj.get("snake_case"), - "var_property": obj.get("property"), - "var_123_number": obj.get("123Number") - }) - return _obj - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/nullable_class.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/nullable_class.py deleted file mode 100644 index f26aac9ff07d..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/nullable_class.py +++ /dev/null @@ -1,162 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - -from datetime import date, datetime -from typing import Any, Dict, List, Optional -from pydantic import BaseModel, Field, StrictBool, StrictInt, StrictStr, conlist - -class NullableClass(BaseModel): - """ - NullableClass - """ - required_integer_prop: Optional[StrictInt] = Field(...) - integer_prop: Optional[StrictInt] = None - number_prop: Optional[float] = None - boolean_prop: Optional[StrictBool] = None - string_prop: Optional[StrictStr] = None - date_prop: Optional[date] = None - datetime_prop: Optional[datetime] = None - array_nullable_prop: Optional[conlist(Dict[str, Any])] = None - array_and_items_nullable_prop: Optional[conlist(Dict[str, Any])] = None - array_items_nullable: Optional[conlist(Dict[str, Any])] = None - object_nullable_prop: Optional[Dict[str, Dict[str, Any]]] = None - object_and_items_nullable_prop: Optional[Dict[str, Dict[str, Any]]] = None - object_items_nullable: Optional[Dict[str, Dict[str, Any]]] = None - additional_properties: Dict[str, Any] = {} - __properties = ["required_integer_prop", "integer_prop", "number_prop", "boolean_prop", "string_prop", "date_prop", "datetime_prop", "array_nullable_prop", "array_and_items_nullable_prop", "array_items_nullable", "object_nullable_prop", "object_and_items_nullable_prop", "object_items_nullable"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> NullableClass: - """Create an instance of NullableClass from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - "additional_properties" - }, - exclude_none=True) - # puts key-value pairs in additional_properties in the top level - if self.additional_properties is not None: - for _key, _value in self.additional_properties.items(): - _dict[_key] = _value - - # set to None if required_integer_prop (nullable) is None - # and __fields_set__ contains the field - if self.required_integer_prop is None and "required_integer_prop" in self.__fields_set__: - _dict['required_integer_prop'] = None - - # set to None if integer_prop (nullable) is None - # and __fields_set__ contains the field - if self.integer_prop is None and "integer_prop" in self.__fields_set__: - _dict['integer_prop'] = None - - # set to None if number_prop (nullable) is None - # and __fields_set__ contains the field - if self.number_prop is None and "number_prop" in self.__fields_set__: - _dict['number_prop'] = None - - # set to None if boolean_prop (nullable) is None - # and __fields_set__ contains the field - if self.boolean_prop is None and "boolean_prop" in self.__fields_set__: - _dict['boolean_prop'] = None - - # set to None if string_prop (nullable) is None - # and __fields_set__ contains the field - if self.string_prop is None and "string_prop" in self.__fields_set__: - _dict['string_prop'] = None - - # set to None if date_prop (nullable) is None - # and __fields_set__ contains the field - if self.date_prop is None and "date_prop" in self.__fields_set__: - _dict['date_prop'] = None - - # set to None if datetime_prop (nullable) is None - # and __fields_set__ contains the field - if self.datetime_prop is None and "datetime_prop" in self.__fields_set__: - _dict['datetime_prop'] = None - - # set to None if array_nullable_prop (nullable) is None - # and __fields_set__ contains the field - if self.array_nullable_prop is None and "array_nullable_prop" in self.__fields_set__: - _dict['array_nullable_prop'] = None - - # set to None if array_and_items_nullable_prop (nullable) is None - # and __fields_set__ contains the field - if self.array_and_items_nullable_prop is None and "array_and_items_nullable_prop" in self.__fields_set__: - _dict['array_and_items_nullable_prop'] = None - - # set to None if object_nullable_prop (nullable) is None - # and __fields_set__ contains the field - if self.object_nullable_prop is None and "object_nullable_prop" in self.__fields_set__: - _dict['object_nullable_prop'] = None - - # set to None if object_and_items_nullable_prop (nullable) is None - # and __fields_set__ contains the field - if self.object_and_items_nullable_prop is None and "object_and_items_nullable_prop" in self.__fields_set__: - _dict['object_and_items_nullable_prop'] = None - - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> NullableClass: - """Create an instance of NullableClass from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return NullableClass.parse_obj(obj) - - _obj = NullableClass.parse_obj({ - "required_integer_prop": obj.get("required_integer_prop"), - "integer_prop": obj.get("integer_prop"), - "number_prop": obj.get("number_prop"), - "boolean_prop": obj.get("boolean_prop"), - "string_prop": obj.get("string_prop"), - "date_prop": obj.get("date_prop"), - "datetime_prop": obj.get("datetime_prop"), - "array_nullable_prop": obj.get("array_nullable_prop"), - "array_and_items_nullable_prop": obj.get("array_and_items_nullable_prop"), - "array_items_nullable": obj.get("array_items_nullable"), - "object_nullable_prop": obj.get("object_nullable_prop"), - "object_and_items_nullable_prop": obj.get("object_and_items_nullable_prop"), - "object_items_nullable": obj.get("object_items_nullable") - }) - # store additional fields in additional_properties - for _key in obj.keys(): - if _key not in cls.__properties: - _obj.additional_properties[_key] = obj.get(_key) - - return _obj - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/nullable_property.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/nullable_property.py deleted file mode 100644 index 2312fbbbf5fd..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/nullable_property.py +++ /dev/null @@ -1,88 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Optional -from pydantic import BaseModel, Field, StrictInt, constr, validator - -class NullableProperty(BaseModel): - """ - NullableProperty - """ - id: StrictInt = Field(...) - name: Optional[constr(strict=True)] = Field(...) - __properties = ["id", "name"] - - @validator('name') - def name_validate_regular_expression(cls, value): - """Validates the regular expression""" - if value is None: - return value - - if not re.match(r"^[A-Z].*", value): - raise ValueError(r"must validate the regular expression /^[A-Z].*/") - return value - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> NullableProperty: - """Create an instance of NullableProperty from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - # set to None if name (nullable) is None - # and __fields_set__ contains the field - if self.name is None and "name" in self.__fields_set__: - _dict['name'] = None - - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> NullableProperty: - """Create an instance of NullableProperty from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return NullableProperty.parse_obj(obj) - - _obj = NullableProperty.parse_obj({ - "id": obj.get("id"), - "name": obj.get("name") - }) - return _obj - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/number_only.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/number_only.py deleted file mode 100644 index 6549b2617824..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/number_only.py +++ /dev/null @@ -1,71 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Optional -from pydantic import BaseModel, Field - -class NumberOnly(BaseModel): - """ - NumberOnly - """ - just_number: Optional[float] = Field(None, alias="JustNumber") - __properties = ["JustNumber"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> NumberOnly: - """Create an instance of NumberOnly from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> NumberOnly: - """Create an instance of NumberOnly from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return NumberOnly.parse_obj(obj) - - _obj = NumberOnly.parse_obj({ - "just_number": obj.get("JustNumber") - }) - return _obj - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/object_to_test_additional_properties.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/object_to_test_additional_properties.py deleted file mode 100644 index f609e06f6a9c..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/object_to_test_additional_properties.py +++ /dev/null @@ -1,71 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Optional -from pydantic import BaseModel, Field, StrictBool - -class ObjectToTestAdditionalProperties(BaseModel): - """ - Minimal object # noqa: E501 - """ - var_property: Optional[StrictBool] = Field(False, alias="property", description="Property") - __properties = ["property"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> ObjectToTestAdditionalProperties: - """Create an instance of ObjectToTestAdditionalProperties from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> ObjectToTestAdditionalProperties: - """Create an instance of ObjectToTestAdditionalProperties from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return ObjectToTestAdditionalProperties.parse_obj(obj) - - _obj = ObjectToTestAdditionalProperties.parse_obj({ - "var_property": obj.get("property") if obj.get("property") is not None else False - }) - return _obj - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/object_with_deprecated_fields.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/object_with_deprecated_fields.py deleted file mode 100644 index 421206c1bc79..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/object_with_deprecated_fields.py +++ /dev/null @@ -1,81 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import List, Optional -from pydantic import BaseModel, Field, StrictStr, conlist -from petstore_api.models.deprecated_object import DeprecatedObject - -class ObjectWithDeprecatedFields(BaseModel): - """ - ObjectWithDeprecatedFields - """ - uuid: Optional[StrictStr] = None - id: Optional[float] = None - deprecated_ref: Optional[DeprecatedObject] = Field(None, alias="deprecatedRef") - bars: Optional[conlist(StrictStr)] = None - __properties = ["uuid", "id", "deprecatedRef", "bars"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> ObjectWithDeprecatedFields: - """Create an instance of ObjectWithDeprecatedFields from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - # override the default output from pydantic by calling `to_dict()` of deprecated_ref - if self.deprecated_ref: - _dict['deprecatedRef'] = self.deprecated_ref.to_dict() - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> ObjectWithDeprecatedFields: - """Create an instance of ObjectWithDeprecatedFields from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return ObjectWithDeprecatedFields.parse_obj(obj) - - _obj = ObjectWithDeprecatedFields.parse_obj({ - "uuid": obj.get("uuid"), - "id": obj.get("id"), - "deprecated_ref": DeprecatedObject.from_dict(obj.get("deprecatedRef")) if obj.get("deprecatedRef") is not None else None, - "bars": obj.get("bars") - }) - return _obj - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/one_of_enum_string.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/one_of_enum_string.py deleted file mode 100644 index d7ae93ccb6a8..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/one_of_enum_string.py +++ /dev/null @@ -1,141 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -from inspect import getfullargspec -import json -import pprint -import re # noqa: F401 - -from typing import Any, List, Optional -from pydantic import BaseModel, Field, StrictStr, ValidationError, validator -from petstore_api.models.enum_string1 import EnumString1 -from petstore_api.models.enum_string2 import EnumString2 -from typing import Union, Any, List, TYPE_CHECKING -from pydantic import StrictStr, Field - -ONEOFENUMSTRING_ONE_OF_SCHEMAS = ["EnumString1", "EnumString2"] - -class OneOfEnumString(BaseModel): - """ - oneOf enum strings - """ - # data type: EnumString1 - oneof_schema_1_validator: Optional[EnumString1] = None - # data type: EnumString2 - oneof_schema_2_validator: Optional[EnumString2] = None - if TYPE_CHECKING: - actual_instance: Union[EnumString1, EnumString2] - else: - actual_instance: Any - one_of_schemas: List[str] = Field(ONEOFENUMSTRING_ONE_OF_SCHEMAS, const=True) - - class Config: - validate_assignment = True - - def __init__(self, *args, **kwargs) -> None: - if args: - if len(args) > 1: - raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") - if kwargs: - raise ValueError("If a position argument is used, keyword arguments cannot be used.") - super().__init__(actual_instance=args[0]) - else: - super().__init__(**kwargs) - - @validator('actual_instance') - def actual_instance_must_validate_oneof(cls, v): - instance = OneOfEnumString.construct() - error_messages = [] - match = 0 - # validate data type: EnumString1 - if not isinstance(v, EnumString1): - error_messages.append(f"Error! Input type `{type(v)}` is not `EnumString1`") - else: - match += 1 - # validate data type: EnumString2 - if not isinstance(v, EnumString2): - error_messages.append(f"Error! Input type `{type(v)}` is not `EnumString2`") - else: - match += 1 - if match > 1: - # more than 1 match - raise ValueError("Multiple matches found when setting `actual_instance` in OneOfEnumString with oneOf schemas: EnumString1, EnumString2. Details: " + ", ".join(error_messages)) - elif match == 0: - # no match - raise ValueError("No match found when setting `actual_instance` in OneOfEnumString with oneOf schemas: EnumString1, EnumString2. Details: " + ", ".join(error_messages)) - else: - return v - - @classmethod - def from_dict(cls, obj: dict) -> OneOfEnumString: - return cls.from_json(json.dumps(obj)) - - @classmethod - def from_json(cls, json_str: str) -> OneOfEnumString: - """Returns the object represented by the json string""" - instance = OneOfEnumString.construct() - error_messages = [] - match = 0 - - # deserialize data into EnumString1 - try: - instance.actual_instance = EnumString1.from_json(json_str) - match += 1 - except (ValidationError, ValueError) as e: - error_messages.append(str(e)) - # deserialize data into EnumString2 - try: - instance.actual_instance = EnumString2.from_json(json_str) - match += 1 - except (ValidationError, ValueError) as e: - error_messages.append(str(e)) - - if match > 1: - # more than 1 match - raise ValueError("Multiple matches found when deserializing the JSON string into OneOfEnumString with oneOf schemas: EnumString1, EnumString2. Details: " + ", ".join(error_messages)) - elif match == 0: - # no match - raise ValueError("No match found when deserializing the JSON string into OneOfEnumString with oneOf schemas: EnumString1, EnumString2. Details: " + ", ".join(error_messages)) - else: - return instance - - def to_json(self) -> str: - """Returns the JSON representation of the actual instance""" - if self.actual_instance is None: - return "null" - - to_json = getattr(self.actual_instance, "to_json", None) - if callable(to_json): - return self.actual_instance.to_json() - else: - return json.dumps(self.actual_instance) - - def to_dict(self) -> dict: - """Returns the dict representation of the actual instance""" - if self.actual_instance is None: - return None - - to_dict = getattr(self.actual_instance, "to_dict", None) - if callable(to_dict): - return self.actual_instance.to_dict() - else: - # primitive type - return self.actual_instance - - def to_str(self) -> str: - """Returns the string representation of the actual instance""" - return pprint.pformat(self.dict()) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/order.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/order.py deleted file mode 100644 index da726d2096dc..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/order.py +++ /dev/null @@ -1,91 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - -from datetime import datetime -from typing import Optional -from pydantic import BaseModel, Field, StrictBool, StrictInt, StrictStr, validator - -class Order(BaseModel): - """ - Order - """ - id: Optional[StrictInt] = None - pet_id: Optional[StrictInt] = Field(None, alias="petId") - quantity: Optional[StrictInt] = None - ship_date: Optional[datetime] = Field(None, alias="shipDate") - status: Optional[StrictStr] = Field(None, description="Order Status") - complete: Optional[StrictBool] = False - __properties = ["id", "petId", "quantity", "shipDate", "status", "complete"] - - @validator('status') - def status_validate_enum(cls, value): - """Validates the enum""" - if value is None: - return value - - if value not in ('placed', 'approved', 'delivered'): - raise ValueError("must be one of enum values ('placed', 'approved', 'delivered')") - return value - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Order: - """Create an instance of Order from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> Order: - """Create an instance of Order from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return Order.parse_obj(obj) - - _obj = Order.parse_obj({ - "id": obj.get("id"), - "pet_id": obj.get("petId"), - "quantity": obj.get("quantity"), - "ship_date": obj.get("shipDate"), - "status": obj.get("status"), - "complete": obj.get("complete") if obj.get("complete") is not None else False - }) - return _obj - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/outer_composite.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/outer_composite.py deleted file mode 100644 index 63627c3d0fde..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/outer_composite.py +++ /dev/null @@ -1,75 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Optional -from pydantic import BaseModel, StrictBool, StrictStr - -class OuterComposite(BaseModel): - """ - OuterComposite - """ - my_number: Optional[float] = None - my_string: Optional[StrictStr] = None - my_boolean: Optional[StrictBool] = None - __properties = ["my_number", "my_string", "my_boolean"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> OuterComposite: - """Create an instance of OuterComposite from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> OuterComposite: - """Create an instance of OuterComposite from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return OuterComposite.parse_obj(obj) - - _obj = OuterComposite.parse_obj({ - "my_number": obj.get("my_number"), - "my_string": obj.get("my_string"), - "my_boolean": obj.get("my_boolean") - }) - return _obj - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/outer_enum.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/outer_enum.py deleted file mode 100644 index bfb06a008b56..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/outer_enum.py +++ /dev/null @@ -1,41 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import json -import pprint -import re # noqa: F401 -from aenum import Enum, no_arg - - - - - -class OuterEnum(str, Enum): - """ - OuterEnum - """ - - """ - allowed enum values - """ - PLACED = 'placed' - APPROVED = 'approved' - DELIVERED = 'delivered' - - @classmethod - def from_json(cls, json_str: str) -> OuterEnum: - """Create an instance of OuterEnum from a JSON string""" - return OuterEnum(json.loads(json_str)) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/outer_enum_default_value.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/outer_enum_default_value.py deleted file mode 100644 index 807c36f0fe5f..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/outer_enum_default_value.py +++ /dev/null @@ -1,41 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import json -import pprint -import re # noqa: F401 -from aenum import Enum, no_arg - - - - - -class OuterEnumDefaultValue(str, Enum): - """ - OuterEnumDefaultValue - """ - - """ - allowed enum values - """ - PLACED = 'placed' - APPROVED = 'approved' - DELIVERED = 'delivered' - - @classmethod - def from_json(cls, json_str: str) -> OuterEnumDefaultValue: - """Create an instance of OuterEnumDefaultValue from a JSON string""" - return OuterEnumDefaultValue(json.loads(json_str)) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/outer_enum_integer.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/outer_enum_integer.py deleted file mode 100644 index 77ae46fa7059..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/outer_enum_integer.py +++ /dev/null @@ -1,41 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import json -import pprint -import re # noqa: F401 -from aenum import Enum, no_arg - - - - - -class OuterEnumInteger(int, Enum): - """ - OuterEnumInteger - """ - - """ - allowed enum values - """ - NUMBER_0 = 0 - NUMBER_1 = 1 - NUMBER_2 = 2 - - @classmethod - def from_json(cls, json_str: str) -> OuterEnumInteger: - """Create an instance of OuterEnumInteger from a JSON string""" - return OuterEnumInteger(json.loads(json_str)) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/outer_enum_integer_default_value.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/outer_enum_integer_default_value.py deleted file mode 100644 index 36381197bb71..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/outer_enum_integer_default_value.py +++ /dev/null @@ -1,42 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import json -import pprint -import re # noqa: F401 -from aenum import Enum, no_arg - - - - - -class OuterEnumIntegerDefaultValue(int, Enum): - """ - OuterEnumIntegerDefaultValue - """ - - """ - allowed enum values - """ - NUMBER_MINUS_1 = -1 - NUMBER_0 = 0 - NUMBER_1 = 1 - NUMBER_2 = 2 - - @classmethod - def from_json(cls, json_str: str) -> OuterEnumIntegerDefaultValue: - """Create an instance of OuterEnumIntegerDefaultValue from a JSON string""" - return OuterEnumIntegerDefaultValue(json.loads(json_str)) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/outer_object_with_enum_property.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/outer_object_with_enum_property.py deleted file mode 100644 index c4ae68e5510f..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/outer_object_with_enum_property.py +++ /dev/null @@ -1,80 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Optional -from pydantic import BaseModel, Field -from petstore_api.models.outer_enum import OuterEnum -from petstore_api.models.outer_enum_integer import OuterEnumInteger - -class OuterObjectWithEnumProperty(BaseModel): - """ - OuterObjectWithEnumProperty - """ - str_value: Optional[OuterEnum] = None - value: OuterEnumInteger = Field(...) - __properties = ["str_value", "value"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> OuterObjectWithEnumProperty: - """Create an instance of OuterObjectWithEnumProperty from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - # set to None if str_value (nullable) is None - # and __fields_set__ contains the field - if self.str_value is None and "str_value" in self.__fields_set__: - _dict['str_value'] = None - - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> OuterObjectWithEnumProperty: - """Create an instance of OuterObjectWithEnumProperty from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return OuterObjectWithEnumProperty.parse_obj(obj) - - _obj = OuterObjectWithEnumProperty.parse_obj({ - "str_value": obj.get("str_value"), - "value": obj.get("value") - }) - return _obj - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/parent.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/parent.py deleted file mode 100644 index a3105aff6821..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/parent.py +++ /dev/null @@ -1,84 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Dict, Optional -from pydantic import BaseModel, Field -from petstore_api.models.inner_dict_with_property import InnerDictWithProperty - -class Parent(BaseModel): - """ - Parent - """ - optional_dict: Optional[Dict[str, InnerDictWithProperty]] = Field(None, alias="optionalDict") - __properties = ["optionalDict"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Parent: - """Create an instance of Parent from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - # override the default output from pydantic by calling `to_dict()` of each value in optional_dict (dict) - _field_dict = {} - if self.optional_dict: - for _key in self.optional_dict: - if self.optional_dict[_key]: - _field_dict[_key] = self.optional_dict[_key].to_dict() - _dict['optionalDict'] = _field_dict - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> Parent: - """Create an instance of Parent from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return Parent.parse_obj(obj) - - _obj = Parent.parse_obj({ - "optional_dict": dict( - (_k, InnerDictWithProperty.from_dict(_v)) - for _k, _v in obj.get("optionalDict").items() - ) - if obj.get("optionalDict") is not None - else None - }) - return _obj - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/parent_with_optional_dict.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/parent_with_optional_dict.py deleted file mode 100644 index 253747b3abd7..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/parent_with_optional_dict.py +++ /dev/null @@ -1,84 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Dict, Optional -from pydantic import BaseModel, Field -from petstore_api.models.inner_dict_with_property import InnerDictWithProperty - -class ParentWithOptionalDict(BaseModel): - """ - ParentWithOptionalDict - """ - optional_dict: Optional[Dict[str, InnerDictWithProperty]] = Field(None, alias="optionalDict") - __properties = ["optionalDict"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> ParentWithOptionalDict: - """Create an instance of ParentWithOptionalDict from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - # override the default output from pydantic by calling `to_dict()` of each value in optional_dict (dict) - _field_dict = {} - if self.optional_dict: - for _key in self.optional_dict: - if self.optional_dict[_key]: - _field_dict[_key] = self.optional_dict[_key].to_dict() - _dict['optionalDict'] = _field_dict - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> ParentWithOptionalDict: - """Create an instance of ParentWithOptionalDict from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return ParentWithOptionalDict.parse_obj(obj) - - _obj = ParentWithOptionalDict.parse_obj({ - "optional_dict": dict( - (_k, InnerDictWithProperty.from_dict(_v)) - for _k, _v in obj.get("optionalDict").items() - ) - if obj.get("optionalDict") is not None - else None - }) - return _obj - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/pet.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/pet.py deleted file mode 100644 index e45fdc4a27d7..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/pet.py +++ /dev/null @@ -1,103 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import List, Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr, conlist, validator -from petstore_api.models.category import Category -from petstore_api.models.tag import Tag - -class Pet(BaseModel): - """ - Pet - """ - id: Optional[StrictInt] = None - category: Optional[Category] = None - name: StrictStr = Field(...) - photo_urls: conlist(StrictStr, min_items=0, unique_items=True) = Field(..., alias="photoUrls") - tags: Optional[conlist(Tag)] = None - status: Optional[StrictStr] = Field(None, description="pet status in the store") - __properties = ["id", "category", "name", "photoUrls", "tags", "status"] - - @validator('status') - def status_validate_enum(cls, value): - """Validates the enum""" - if value is None: - return value - - if value not in ('available', 'pending', 'sold'): - raise ValueError("must be one of enum values ('available', 'pending', 'sold')") - return value - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Pet: - """Create an instance of Pet from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - # override the default output from pydantic by calling `to_dict()` of category - if self.category: - _dict['category'] = self.category.to_dict() - # override the default output from pydantic by calling `to_dict()` of each item in tags (list) - _items = [] - if self.tags: - for _item in self.tags: - if _item: - _items.append(_item.to_dict()) - _dict['tags'] = _items - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> Pet: - """Create an instance of Pet from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return Pet.parse_obj(obj) - - _obj = Pet.parse_obj({ - "id": obj.get("id"), - "category": Category.from_dict(obj.get("category")) if obj.get("category") is not None else None, - "name": obj.get("name"), - "photo_urls": obj.get("photoUrls"), - "tags": [Tag.from_dict(_item) for _item in obj.get("tags")] if obj.get("tags") is not None else None, - "status": obj.get("status") - }) - return _obj - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/pig.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/pig.py deleted file mode 100644 index 1cb002bf6f7d..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/pig.py +++ /dev/null @@ -1,144 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -from inspect import getfullargspec -import json -import pprint -import re # noqa: F401 - -from typing import Any, List, Optional -from pydantic import BaseModel, Field, StrictStr, ValidationError, validator -from petstore_api.models.basque_pig import BasquePig -from petstore_api.models.danish_pig import DanishPig -from typing import Union, Any, List, TYPE_CHECKING -from pydantic import StrictStr, Field - -PIG_ONE_OF_SCHEMAS = ["BasquePig", "DanishPig"] - -class Pig(BaseModel): - """ - Pig - """ - # data type: BasquePig - oneof_schema_1_validator: Optional[BasquePig] = None - # data type: DanishPig - oneof_schema_2_validator: Optional[DanishPig] = None - if TYPE_CHECKING: - actual_instance: Union[BasquePig, DanishPig] - else: - actual_instance: Any - one_of_schemas: List[str] = Field(PIG_ONE_OF_SCHEMAS, const=True) - - class Config: - validate_assignment = True - - discriminator_value_class_map = { - } - - def __init__(self, *args, **kwargs) -> None: - if args: - if len(args) > 1: - raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") - if kwargs: - raise ValueError("If a position argument is used, keyword arguments cannot be used.") - super().__init__(actual_instance=args[0]) - else: - super().__init__(**kwargs) - - @validator('actual_instance') - def actual_instance_must_validate_oneof(cls, v): - instance = Pig.construct() - error_messages = [] - match = 0 - # validate data type: BasquePig - if not isinstance(v, BasquePig): - error_messages.append(f"Error! Input type `{type(v)}` is not `BasquePig`") - else: - match += 1 - # validate data type: DanishPig - if not isinstance(v, DanishPig): - error_messages.append(f"Error! Input type `{type(v)}` is not `DanishPig`") - else: - match += 1 - if match > 1: - # more than 1 match - raise ValueError("Multiple matches found when setting `actual_instance` in Pig with oneOf schemas: BasquePig, DanishPig. Details: " + ", ".join(error_messages)) - elif match == 0: - # no match - raise ValueError("No match found when setting `actual_instance` in Pig with oneOf schemas: BasquePig, DanishPig. Details: " + ", ".join(error_messages)) - else: - return v - - @classmethod - def from_dict(cls, obj: dict) -> Pig: - return cls.from_json(json.dumps(obj)) - - @classmethod - def from_json(cls, json_str: str) -> Pig: - """Returns the object represented by the json string""" - instance = Pig.construct() - error_messages = [] - match = 0 - - # deserialize data into BasquePig - try: - instance.actual_instance = BasquePig.from_json(json_str) - match += 1 - except (ValidationError, ValueError) as e: - error_messages.append(str(e)) - # deserialize data into DanishPig - try: - instance.actual_instance = DanishPig.from_json(json_str) - match += 1 - except (ValidationError, ValueError) as e: - error_messages.append(str(e)) - - if match > 1: - # more than 1 match - raise ValueError("Multiple matches found when deserializing the JSON string into Pig with oneOf schemas: BasquePig, DanishPig. Details: " + ", ".join(error_messages)) - elif match == 0: - # no match - raise ValueError("No match found when deserializing the JSON string into Pig with oneOf schemas: BasquePig, DanishPig. Details: " + ", ".join(error_messages)) - else: - return instance - - def to_json(self) -> str: - """Returns the JSON representation of the actual instance""" - if self.actual_instance is None: - return "null" - - to_json = getattr(self.actual_instance, "to_json", None) - if callable(to_json): - return self.actual_instance.to_json() - else: - return json.dumps(self.actual_instance) - - def to_dict(self) -> dict: - """Returns the dict representation of the actual instance""" - if self.actual_instance is None: - return None - - to_dict = getattr(self.actual_instance, "to_dict", None) - if callable(to_dict): - return self.actual_instance.to_dict() - else: - # primitive type - return self.actual_instance - - def to_str(self) -> str: - """Returns the string representation of the actual instance""" - return pprint.pformat(self.dict()) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/property_name_collision.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/property_name_collision.py deleted file mode 100644 index ed45ecdf74c4..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/property_name_collision.py +++ /dev/null @@ -1,75 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr - -class PropertyNameCollision(BaseModel): - """ - PropertyNameCollision - """ - type: Optional[StrictStr] = Field(None, alias="_type") - type: Optional[StrictStr] = None - type_: Optional[StrictStr] = None - __properties = ["_type", "type", "type_"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> PropertyNameCollision: - """Create an instance of PropertyNameCollision from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> PropertyNameCollision: - """Create an instance of PropertyNameCollision from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return PropertyNameCollision.parse_obj(obj) - - _obj = PropertyNameCollision.parse_obj({ - "type": obj.get("_type"), - "type": obj.get("type"), - "type_": obj.get("type_") - }) - return _obj - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/read_only_first.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/read_only_first.py deleted file mode 100644 index da66589ee79c..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/read_only_first.py +++ /dev/null @@ -1,74 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Optional -from pydantic import BaseModel, StrictStr - -class ReadOnlyFirst(BaseModel): - """ - ReadOnlyFirst - """ - bar: Optional[StrictStr] = None - baz: Optional[StrictStr] = None - __properties = ["bar", "baz"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> ReadOnlyFirst: - """Create an instance of ReadOnlyFirst from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - "bar", - }, - exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> ReadOnlyFirst: - """Create an instance of ReadOnlyFirst from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return ReadOnlyFirst.parse_obj(obj) - - _obj = ReadOnlyFirst.parse_obj({ - "bar": obj.get("bar"), - "baz": obj.get("baz") - }) - return _obj - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/second_ref.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/second_ref.py deleted file mode 100644 index 0c4f70eb9395..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/second_ref.py +++ /dev/null @@ -1,78 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Optional -from pydantic import BaseModel, StrictStr - -class SecondRef(BaseModel): - """ - SecondRef - """ - category: Optional[StrictStr] = None - circular_ref: Optional[CircularReferenceModel] = None - __properties = ["category", "circular_ref"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> SecondRef: - """Create an instance of SecondRef from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - # override the default output from pydantic by calling `to_dict()` of circular_ref - if self.circular_ref: - _dict['circular_ref'] = self.circular_ref.to_dict() - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> SecondRef: - """Create an instance of SecondRef from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return SecondRef.parse_obj(obj) - - _obj = SecondRef.parse_obj({ - "category": obj.get("category"), - "circular_ref": CircularReferenceModel.from_dict(obj.get("circular_ref")) if obj.get("circular_ref") is not None else None - }) - return _obj - -from petstore_api.models.circular_reference_model import CircularReferenceModel -SecondRef.update_forward_refs() - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/self_reference_model.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/self_reference_model.py deleted file mode 100644 index f7470db995e6..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/self_reference_model.py +++ /dev/null @@ -1,78 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Optional -from pydantic import BaseModel, StrictInt - -class SelfReferenceModel(BaseModel): - """ - SelfReferenceModel - """ - size: Optional[StrictInt] = None - nested: Optional[DummyModel] = None - __properties = ["size", "nested"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> SelfReferenceModel: - """Create an instance of SelfReferenceModel from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - # override the default output from pydantic by calling `to_dict()` of nested - if self.nested: - _dict['nested'] = self.nested.to_dict() - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> SelfReferenceModel: - """Create an instance of SelfReferenceModel from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return SelfReferenceModel.parse_obj(obj) - - _obj = SelfReferenceModel.parse_obj({ - "size": obj.get("size"), - "nested": DummyModel.from_dict(obj.get("nested")) if obj.get("nested") is not None else None - }) - return _obj - -from petstore_api.models.dummy_model import DummyModel -SelfReferenceModel.update_forward_refs() - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/single_ref_type.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/single_ref_type.py deleted file mode 100644 index 7edec4bb32cc..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/single_ref_type.py +++ /dev/null @@ -1,40 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import json -import pprint -import re # noqa: F401 -from aenum import Enum, no_arg - - - - - -class SingleRefType(str, Enum): - """ - SingleRefType - """ - - """ - allowed enum values - """ - ADMIN = 'admin' - USER = 'user' - - @classmethod - def from_json(cls, json_str: str) -> SingleRefType: - """Create an instance of SingleRefType from a JSON string""" - return SingleRefType(json.loads(json_str)) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/special_character_enum.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/special_character_enum.py deleted file mode 100644 index 14b8a7e3fd67..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/special_character_enum.py +++ /dev/null @@ -1,48 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import json -import pprint -import re # noqa: F401 -from aenum import Enum, no_arg - - - - - -class SpecialCharacterEnum(str, Enum): - """ - SpecialCharacterEnum - """ - - """ - allowed enum values - """ - ENUM_456 = '456' - ENUM_123ABC = '123abc' - UNDERSCORE = '_' - SPACE = ' ' - AMPERSAND = '&' - DOLLAR = '$' - GREATER_THAN_EQUAL = '>=' - THIS_IS_EXCLAMATION = 'this_is_!' - IMPORT = 'import' - HELLO_WORLD = ' hello world ' - - @classmethod - def from_json(cls, json_str: str) -> SpecialCharacterEnum: - """Create an instance of SpecialCharacterEnum from a JSON string""" - return SpecialCharacterEnum(json.loads(json_str)) - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/special_model_name.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/special_model_name.py deleted file mode 100644 index 43e57ff7b7bd..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/special_model_name.py +++ /dev/null @@ -1,71 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Optional -from pydantic import BaseModel, Field, StrictInt - -class SpecialModelName(BaseModel): - """ - SpecialModelName - """ - special_property_name: Optional[StrictInt] = Field(None, alias="$special[property.name]") - __properties = ["$special[property.name]"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> SpecialModelName: - """Create an instance of SpecialModelName from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> SpecialModelName: - """Create an instance of SpecialModelName from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return SpecialModelName.parse_obj(obj) - - _obj = SpecialModelName.parse_obj({ - "special_property_name": obj.get("$special[property.name]") - }) - return _obj - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/special_name.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/special_name.py deleted file mode 100644 index f8841f7a4cce..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/special_name.py +++ /dev/null @@ -1,89 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr, validator -from petstore_api.models.category import Category - -class SpecialName(BaseModel): - """ - SpecialName - """ - var_property: Optional[StrictInt] = Field(None, alias="property") - var_async: Optional[Category] = Field(None, alias="async") - var_schema: Optional[StrictStr] = Field(None, alias="schema", description="pet status in the store") - __properties = ["property", "async", "schema"] - - @validator('var_schema') - def var_schema_validate_enum(cls, value): - """Validates the enum""" - if value is None: - return value - - if value not in ('available', 'pending', 'sold'): - raise ValueError("must be one of enum values ('available', 'pending', 'sold')") - return value - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> SpecialName: - """Create an instance of SpecialName from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - # override the default output from pydantic by calling `to_dict()` of var_async - if self.var_async: - _dict['async'] = self.var_async.to_dict() - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> SpecialName: - """Create an instance of SpecialName from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return SpecialName.parse_obj(obj) - - _obj = SpecialName.parse_obj({ - "var_property": obj.get("property"), - "var_async": Category.from_dict(obj.get("async")) if obj.get("async") is not None else None, - "var_schema": obj.get("schema") - }) - return _obj - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/tag.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/tag.py deleted file mode 100644 index 45605d239331..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/tag.py +++ /dev/null @@ -1,73 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Optional -from pydantic import BaseModel, StrictInt, StrictStr - -class Tag(BaseModel): - """ - Tag - """ - id: Optional[StrictInt] = None - name: Optional[StrictStr] = None - __properties = ["id", "name"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Tag: - """Create an instance of Tag from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> Tag: - """Create an instance of Tag from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return Tag.parse_obj(obj) - - _obj = Tag.parse_obj({ - "id": obj.get("id"), - "name": obj.get("name") - }) - return _obj - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/test_inline_freeform_additional_properties_request.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/test_inline_freeform_additional_properties_request.py deleted file mode 100644 index a77233c5677a..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/test_inline_freeform_additional_properties_request.py +++ /dev/null @@ -1,83 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr - -class TestInlineFreeformAdditionalPropertiesRequest(BaseModel): - """ - TestInlineFreeformAdditionalPropertiesRequest - """ - some_property: Optional[StrictStr] = Field(None, alias="someProperty") - additional_properties: Dict[str, Any] = {} - __properties = ["someProperty"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> TestInlineFreeformAdditionalPropertiesRequest: - """Create an instance of TestInlineFreeformAdditionalPropertiesRequest from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - "additional_properties" - }, - exclude_none=True) - # puts key-value pairs in additional_properties in the top level - if self.additional_properties is not None: - for _key, _value in self.additional_properties.items(): - _dict[_key] = _value - - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> TestInlineFreeformAdditionalPropertiesRequest: - """Create an instance of TestInlineFreeformAdditionalPropertiesRequest from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return TestInlineFreeformAdditionalPropertiesRequest.parse_obj(obj) - - _obj = TestInlineFreeformAdditionalPropertiesRequest.parse_obj({ - "some_property": obj.get("someProperty") - }) - # store additional fields in additional_properties - for _key in obj.keys(): - if _key not in cls.__properties: - _obj.additional_properties[_key] = obj.get(_key) - - return _obj - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/tiger.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/tiger.py deleted file mode 100644 index 88b2f3c6a04f..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/tiger.py +++ /dev/null @@ -1,71 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Optional -from pydantic import BaseModel, StrictStr - -class Tiger(BaseModel): - """ - Tiger - """ - skill: Optional[StrictStr] = None - __properties = ["skill"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Tiger: - """Create an instance of Tiger from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> Tiger: - """Create an instance of Tiger from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return Tiger.parse_obj(obj) - - _obj = Tiger.parse_obj({ - "skill": obj.get("skill") - }) - return _obj - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/user.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/user.py deleted file mode 100644 index 5c09a897c702..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/user.py +++ /dev/null @@ -1,85 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr - -class User(BaseModel): - """ - User - """ - id: Optional[StrictInt] = None - username: Optional[StrictStr] = None - first_name: Optional[StrictStr] = Field(None, alias="firstName") - last_name: Optional[StrictStr] = Field(None, alias="lastName") - email: Optional[StrictStr] = None - password: Optional[StrictStr] = None - phone: Optional[StrictStr] = None - user_status: Optional[StrictInt] = Field(None, alias="userStatus", description="User Status") - __properties = ["id", "username", "firstName", "lastName", "email", "password", "phone", "userStatus"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> User: - """Create an instance of User from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> User: - """Create an instance of User from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return User.parse_obj(obj) - - _obj = User.parse_obj({ - "id": obj.get("id"), - "username": obj.get("username"), - "first_name": obj.get("firstName"), - "last_name": obj.get("lastName"), - "email": obj.get("email"), - "password": obj.get("password"), - "phone": obj.get("phone"), - "user_status": obj.get("userStatus") - }) - return _obj - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/with_nested_one_of.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/with_nested_one_of.py deleted file mode 100644 index 0268402b5f4c..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/with_nested_one_of.py +++ /dev/null @@ -1,83 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Optional -from pydantic import BaseModel, StrictInt -from petstore_api.models.one_of_enum_string import OneOfEnumString -from petstore_api.models.pig import Pig - -class WithNestedOneOf(BaseModel): - """ - WithNestedOneOf - """ - size: Optional[StrictInt] = None - nested_pig: Optional[Pig] = None - nested_oneof_enum_string: Optional[OneOfEnumString] = None - __properties = ["size", "nested_pig", "nested_oneof_enum_string"] - - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> WithNestedOneOf: - """Create an instance of WithNestedOneOf from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, - exclude={ - }, - exclude_none=True) - # override the default output from pydantic by calling `to_dict()` of nested_pig - if self.nested_pig: - _dict['nested_pig'] = self.nested_pig.to_dict() - # override the default output from pydantic by calling `to_dict()` of nested_oneof_enum_string - if self.nested_oneof_enum_string: - _dict['nested_oneof_enum_string'] = self.nested_oneof_enum_string.to_dict() - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> WithNestedOneOf: - """Create an instance of WithNestedOneOf from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return WithNestedOneOf.parse_obj(obj) - - _obj = WithNestedOneOf.parse_obj({ - "size": obj.get("size"), - "nested_pig": Pig.from_dict(obj.get("nested_pig")) if obj.get("nested_pig") is not None else None, - "nested_oneof_enum_string": OneOfEnumString.from_dict(obj.get("nested_oneof_enum_string")) if obj.get("nested_oneof_enum_string") is not None else None - }) - return _obj - - diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/py.typed b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/py.typed deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/rest.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/rest.py deleted file mode 100644 index 7daf8c921c84..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/rest.py +++ /dev/null @@ -1,251 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import io -import json -import logging -import re -import ssl - -import aiohttp -from urllib.parse import urlencode, quote_plus - -from petstore_api.exceptions import ApiException, ApiValueError - -logger = logging.getLogger(__name__) - - -class RESTResponse(io.IOBase): - - def __init__(self, resp, data) -> None: - self.aiohttp_response = resp - self.status = resp.status - self.reason = resp.reason - self.data = data - - def getheaders(self): - """Returns a CIMultiDictProxy of the response headers.""" - return self.aiohttp_response.headers - - def getheader(self, name, default=None): - """Returns a given response header.""" - return self.aiohttp_response.headers.get(name, default) - - -class RESTClientObject: - - def __init__(self, configuration, pools_size=4, maxsize=None) -> None: - - # maxsize is number of requests to host that are allowed in parallel - if maxsize is None: - maxsize = configuration.connection_pool_maxsize - - ssl_context = ssl.create_default_context(cafile=configuration.ssl_ca_cert) - if configuration.cert_file: - ssl_context.load_cert_chain( - configuration.cert_file, keyfile=configuration.key_file - ) - - if not configuration.verify_ssl: - ssl_context.check_hostname = False - ssl_context.verify_mode = ssl.CERT_NONE - - connector = aiohttp.TCPConnector( - limit=maxsize, - ssl=ssl_context - ) - - self.proxy = configuration.proxy - self.proxy_headers = configuration.proxy_headers - - # https pool manager - self.pool_manager = aiohttp.ClientSession( - connector=connector, - trust_env=True - ) - - async def close(self): - await self.pool_manager.close() - - async def request(self, method, url, query_params=None, headers=None, - body=None, post_params=None, _preload_content=True, - _request_timeout=None): - """Execute request - - :param method: http request method - :param url: http request url - :param query_params: query parameters in the url - :param headers: http request headers - :param body: request json body, for `application/json` - :param post_params: request post parameters, - `application/x-www-form-urlencoded` - and `multipart/form-data` - :param _preload_content: this is a non-applicable field for - the AiohttpClient. - :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. - """ - method = method.upper() - assert method in ['GET', 'HEAD', 'DELETE', 'POST', 'PUT', - 'PATCH', 'OPTIONS'] - - if post_params and body: - raise ApiValueError( - "body parameter cannot be used with post_params parameter." - ) - - post_params = post_params or {} - headers = headers or {} - # url already contains the URL query string - # so reset query_params to empty dict - query_params = {} - timeout = _request_timeout or 5 * 60 - - if 'Content-Type' not in headers: - headers['Content-Type'] = 'application/json' - - args = { - "method": method, - "url": url, - "timeout": timeout, - "headers": headers - } - - if self.proxy: - args["proxy"] = self.proxy - if self.proxy_headers: - args["proxy_headers"] = self.proxy_headers - - if query_params: - args["url"] += '?' + urlencode(query_params) - - # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` - if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']: - if re.search('json', headers['Content-Type'], re.IGNORECASE): - if body is not None: - body = json.dumps(body) - args["data"] = body - elif headers['Content-Type'] == 'application/x-www-form-urlencoded': # noqa: E501 - args["data"] = aiohttp.FormData(post_params) - elif headers['Content-Type'] == 'multipart/form-data': - # must del headers['Content-Type'], or the correct - # Content-Type which generated by aiohttp - del headers['Content-Type'] - data = aiohttp.FormData() - for param in post_params: - k, v = param - if isinstance(v, tuple) and len(v) == 3: - data.add_field(k, - value=v[1], - filename=v[0], - content_type=v[2]) - else: - data.add_field(k, v) - args["data"] = data - - # Pass a `bytes` parameter directly in the body to support - # other content types than Json when `body` argument is provided - # in serialized form - elif isinstance(body, bytes): - args["data"] = body - else: - # Cannot generate the request from given parameters - msg = """Cannot prepare a request message for provided - arguments. Please check that your arguments match - declared content type.""" - raise ApiException(status=0, reason=msg) - - r = await self.pool_manager.request(**args) - if _preload_content: - - data = await r.read() - r = RESTResponse(r, data) - - # log response body - logger.debug("response body: %s", r.data) - - if not 200 <= r.status <= 299: - raise ApiException(http_resp=r) - - return r - - async def get_request(self, url, headers=None, query_params=None, - _preload_content=True, _request_timeout=None): - return (await self.request("GET", url, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - query_params=query_params)) - - async def head_request(self, url, headers=None, query_params=None, - _preload_content=True, _request_timeout=None): - return (await self.request("HEAD", url, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - query_params=query_params)) - - async def options_request(self, url, headers=None, query_params=None, - post_params=None, body=None, _preload_content=True, - _request_timeout=None): - return (await self.request("OPTIONS", url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body)) - - async def delete_request(self, url, headers=None, query_params=None, body=None, - _preload_content=True, _request_timeout=None): - return (await self.request("DELETE", url, - headers=headers, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body)) - - async def post_request(self, url, headers=None, query_params=None, - post_params=None, body=None, _preload_content=True, - _request_timeout=None): - return (await self.request("POST", url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body)) - - async def put_request(self, url, headers=None, query_params=None, post_params=None, - body=None, _preload_content=True, _request_timeout=None): - return (await self.request("PUT", url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body)) - - async def patch_request(self, url, headers=None, query_params=None, - post_params=None, body=None, _preload_content=True, - _request_timeout=None): - return (await self.request("PATCH", url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body)) diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/signing.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/signing.py deleted file mode 100644 index ec4d7d2a67fd..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/signing.py +++ /dev/null @@ -1,413 +0,0 @@ -""" - 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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from base64 import b64encode -from Crypto.IO import PEM, PKCS8 -from Crypto.Hash import SHA256, SHA512 -from Crypto.PublicKey import RSA, ECC -from Crypto.Signature import PKCS1_v1_5, pss, DSS -from email.utils import formatdate -import json -import os -import re -from time import time -from urllib.parse import urlencode, urlparse - -# The constants below define a subset of HTTP headers that can be included in the -# HTTP signature scheme. Additional headers may be included in the signature. - -# The '(request-target)' header is a calculated field that includes the HTTP verb, -# the URL path and the URL query. -HEADER_REQUEST_TARGET = '(request-target)' -# The time when the HTTP signature was generated. -HEADER_CREATED = '(created)' -# The time when the HTTP signature expires. The API server should reject HTTP requests -# that have expired. -HEADER_EXPIRES = '(expires)' -# The 'Host' header. -HEADER_HOST = 'Host' -# The 'Date' header. -HEADER_DATE = 'Date' -# When the 'Digest' header is included in the HTTP signature, the client automatically -# computes the digest of the HTTP request body, per RFC 3230. -HEADER_DIGEST = 'Digest' -# The 'Authorization' header is automatically generated by the client. It includes -# the list of signed headers and a base64-encoded signature. -HEADER_AUTHORIZATION = 'Authorization' - -# The constants below define the cryptographic schemes for the HTTP signature scheme. -SCHEME_HS2019 = 'hs2019' -SCHEME_RSA_SHA256 = 'rsa-sha256' -SCHEME_RSA_SHA512 = 'rsa-sha512' - -# The constants below define the signature algorithms that can be used for the HTTP -# signature scheme. -ALGORITHM_RSASSA_PSS = 'RSASSA-PSS' -ALGORITHM_RSASSA_PKCS1v15 = 'RSASSA-PKCS1-v1_5' - -ALGORITHM_ECDSA_MODE_FIPS_186_3 = 'fips-186-3' -ALGORITHM_ECDSA_MODE_DETERMINISTIC_RFC6979 = 'deterministic-rfc6979' -ALGORITHM_ECDSA_KEY_SIGNING_ALGORITHMS = { - ALGORITHM_ECDSA_MODE_FIPS_186_3, - ALGORITHM_ECDSA_MODE_DETERMINISTIC_RFC6979 -} - -# The cryptographic hash algorithm for the message signature. -HASH_SHA256 = 'sha256' -HASH_SHA512 = 'sha512' - - -class HttpSigningConfiguration: - """The configuration parameters for the HTTP signature security scheme. - The HTTP signature security scheme is used to sign HTTP requests with a private key - which is in possession of the API client. - An 'Authorization' header is calculated by creating a hash of select headers, - and optionally the body of the HTTP request, then signing the hash value using - a private key. The 'Authorization' header is added to outbound HTTP requests. - - :param key_id: A string value specifying the identifier of the cryptographic key, - when signing HTTP requests. - :param signing_scheme: A string value specifying the signature scheme, when - signing HTTP requests. - Supported value are hs2019, rsa-sha256, rsa-sha512. - Avoid using rsa-sha256, rsa-sha512 as they are deprecated. These values are - available for server-side applications that only support the older - HTTP signature algorithms. - :param private_key_path: A string value specifying the path of the file containing - a private key. The private key is used to sign HTTP requests. - :param private_key_passphrase: A string value specifying the passphrase to decrypt - the private key. - :param signed_headers: A list of strings. Each value is the name of a HTTP header - that must be included in the HTTP signature calculation. - The two special signature headers '(request-target)' and '(created)' SHOULD be - included in SignedHeaders. - The '(created)' header expresses when the signature was created. - The '(request-target)' header is a concatenation of the lowercased :method, an - ASCII space, and the :path pseudo-headers. - When signed_headers is not specified, the client defaults to a single value, - '(created)', in the list of HTTP headers. - When SignedHeaders contains the 'Digest' value, the client performs the - following operations: - 1. Calculate a digest of request body, as specified in RFC3230, section 4.3.2. - 2. Set the 'Digest' header in the request body. - 3. Include the 'Digest' header and value in the HTTP signature. - :param signing_algorithm: A string value specifying the signature algorithm, when - signing HTTP requests. - Supported values are: - 1. For RSA keys: RSASSA-PSS, RSASSA-PKCS1-v1_5. - 2. For ECDSA keys: fips-186-3, deterministic-rfc6979. - If None, the signing algorithm is inferred from the private key. - The default signing algorithm for RSA keys is RSASSA-PSS. - The default signing algorithm for ECDSA keys is fips-186-3. - :param hash_algorithm: The hash algorithm for the signature. Supported values are - sha256 and sha512. - If the signing_scheme is rsa-sha256, the hash algorithm must be set - to None or sha256. - If the signing_scheme is rsa-sha512, the hash algorithm must be set - to None or sha512. - :param signature_max_validity: The signature max validity, expressed as - a datetime.timedelta value. It must be a positive value. - """ - def __init__(self, key_id, signing_scheme, private_key_path, - private_key_passphrase=None, - signed_headers=None, - signing_algorithm=None, - hash_algorithm=None, - signature_max_validity=None) -> None: - self.key_id = key_id - if signing_scheme not in {SCHEME_HS2019, SCHEME_RSA_SHA256, SCHEME_RSA_SHA512}: - raise Exception("Unsupported security scheme: {0}".format(signing_scheme)) - self.signing_scheme = signing_scheme - if not os.path.exists(private_key_path): - raise Exception("Private key file does not exist") - self.private_key_path = private_key_path - self.private_key_passphrase = private_key_passphrase - self.signing_algorithm = signing_algorithm - self.hash_algorithm = hash_algorithm - if signing_scheme == SCHEME_RSA_SHA256: - if self.hash_algorithm is None: - self.hash_algorithm = HASH_SHA256 - elif self.hash_algorithm != HASH_SHA256: - raise Exception("Hash algorithm must be sha256 when security scheme is %s" % - SCHEME_RSA_SHA256) - elif signing_scheme == SCHEME_RSA_SHA512: - if self.hash_algorithm is None: - self.hash_algorithm = HASH_SHA512 - elif self.hash_algorithm != HASH_SHA512: - raise Exception("Hash algorithm must be sha512 when security scheme is %s" % - SCHEME_RSA_SHA512) - elif signing_scheme == SCHEME_HS2019: - if self.hash_algorithm is None: - self.hash_algorithm = HASH_SHA256 - elif self.hash_algorithm not in {HASH_SHA256, HASH_SHA512}: - raise Exception("Invalid hash algorithm") - if signature_max_validity is not None and signature_max_validity.total_seconds() < 0: - raise Exception("The signature max validity must be a positive value") - self.signature_max_validity = signature_max_validity - # If the user has not provided any signed_headers, the default must be set to '(created)', - # as specified in the 'HTTP signature' standard. - if signed_headers is None or len(signed_headers) == 0: - signed_headers = [HEADER_CREATED] - if self.signature_max_validity is None and HEADER_EXPIRES in signed_headers: - raise Exception( - "Signature max validity must be set when " - "'(expires)' signature parameter is specified") - if len(signed_headers) != len(set(signed_headers)): - raise Exception("Cannot have duplicates in the signed_headers parameter") - if HEADER_AUTHORIZATION in signed_headers: - raise Exception("'Authorization' header cannot be included in signed headers") - self.signed_headers = signed_headers - self.private_key = None - """The private key used to sign HTTP requests. - Initialized when the PEM-encoded private key is loaded from a file. - """ - self.host = None - """The host name, optionally followed by a colon and TCP port number. - """ - self._load_private_key() - - def get_http_signature_headers(self, resource_path, method, headers, body, query_params): - """Create a cryptographic message signature for the HTTP request and add the signed headers. - - :param resource_path : A string representation of the HTTP request resource path. - :param method: A string representation of the HTTP request method, e.g. GET, POST. - :param headers: A dict containing the HTTP request headers. - :param body: The object representing the HTTP request body. - :param query_params: A string representing the HTTP request query parameters. - :return: A dict of HTTP headers that must be added to the outbound HTTP request. - """ - if method is None: - raise Exception("HTTP method must be set") - if resource_path is None: - raise Exception("Resource path must be set") - - signed_headers_list, request_headers_dict = self._get_signed_header_info( - resource_path, method, headers, body, query_params) - - header_items = [ - "{0}: {1}".format(key.lower(), value) for key, value in signed_headers_list] - string_to_sign = "\n".join(header_items) - - digest, digest_prefix = self._get_message_digest(string_to_sign.encode()) - b64_signed_msg = self._sign_digest(digest) - - request_headers_dict[HEADER_AUTHORIZATION] = self._get_authorization_header( - signed_headers_list, b64_signed_msg) - - return request_headers_dict - - def get_public_key(self): - """Returns the public key object associated with the private key. - """ - pubkey = None - if isinstance(self.private_key, RSA.RsaKey): - pubkey = self.private_key.publickey() - elif isinstance(self.private_key, ECC.EccKey): - pubkey = self.private_key.public_key() - return pubkey - - def _load_private_key(self): - """Load the private key used to sign HTTP requests. - The private key is used to sign HTTP requests as defined in - https://datatracker.ietf.org/doc/draft-cavage-http-signatures/. - """ - if self.private_key is not None: - return - with open(self.private_key_path, 'r') as f: - pem_data = f.read() - # Verify PEM Pre-Encapsulation Boundary - r = re.compile(r"\s*-----BEGIN (.*)-----\s+") - m = r.match(pem_data) - if not m: - raise ValueError("Not a valid PEM pre boundary") - pem_header = m.group(1) - if pem_header == 'RSA PRIVATE KEY': - self.private_key = RSA.importKey(pem_data, self.private_key_passphrase) - elif pem_header == 'EC PRIVATE KEY': - self.private_key = ECC.import_key(pem_data, self.private_key_passphrase) - elif pem_header in {'PRIVATE KEY', 'ENCRYPTED PRIVATE KEY'}: - # Key is in PKCS8 format, which is capable of holding many different - # types of private keys, not just EC keys. - (key_binary, pem_header, is_encrypted) = \ - PEM.decode(pem_data, self.private_key_passphrase) - (oid, privkey, params) = \ - PKCS8.unwrap(key_binary, passphrase=self.private_key_passphrase) - if oid == '1.2.840.10045.2.1': - self.private_key = ECC.import_key(pem_data, self.private_key_passphrase) - else: - raise Exception("Unsupported key: {0}. OID: {1}".format(pem_header, oid)) - else: - raise Exception("Unsupported key: {0}".format(pem_header)) - # Validate the specified signature algorithm is compatible with the private key. - if self.signing_algorithm is not None: - supported_algs = None - if isinstance(self.private_key, RSA.RsaKey): - supported_algs = {ALGORITHM_RSASSA_PSS, ALGORITHM_RSASSA_PKCS1v15} - elif isinstance(self.private_key, ECC.EccKey): - supported_algs = ALGORITHM_ECDSA_KEY_SIGNING_ALGORITHMS - if supported_algs is not None and self.signing_algorithm not in supported_algs: - raise Exception( - "Signing algorithm {0} is not compatible with private key".format( - self.signing_algorithm)) - - def _get_signed_header_info(self, resource_path, method, headers, body, query_params): - """Build the HTTP headers (name, value) that need to be included in - the HTTP signature scheme. - - :param resource_path : A string representation of the HTTP request resource path. - :param method: A string representation of the HTTP request method, e.g. GET, POST. - :param headers: A dict containing the HTTP request headers. - :param body: The object (e.g. a dict) representing the HTTP request body. - :param query_params: A string representing the HTTP request query parameters. - :return: A tuple containing two dict objects: - The first dict contains the HTTP headers that are used to calculate - the HTTP signature. - The second dict contains the HTTP headers that must be added to - the outbound HTTP request. - """ - - if body is None: - body = '' - else: - body = body.to_json() - - # Build the '(request-target)' HTTP signature parameter. - target_host = urlparse(self.host).netloc - target_path = urlparse(self.host).path - request_target = method.lower() + " " + target_path + resource_path - if query_params: - request_target += "?" + urlencode(query_params) - - # Get UNIX time, e.g. seconds since epoch, not including leap seconds. - now = time() - # Format date per RFC 7231 section-7.1.1.2. An example is: - # Date: Wed, 21 Oct 2015 07:28:00 GMT - cdate = formatdate(timeval=now, localtime=False, usegmt=True) - # The '(created)' value MUST be a Unix timestamp integer value. - # Subsecond precision is not supported. - created = int(now) - if self.signature_max_validity is not None: - expires = now + self.signature_max_validity.total_seconds() - - signed_headers_list = [] - request_headers_dict = {} - for hdr_key in self.signed_headers: - hdr_key = hdr_key.lower() - if hdr_key == HEADER_REQUEST_TARGET: - value = request_target - elif hdr_key == HEADER_CREATED: - value = '{0}'.format(created) - elif hdr_key == HEADER_EXPIRES: - value = '{0}'.format(expires) - elif hdr_key == HEADER_DATE.lower(): - value = cdate - request_headers_dict[HEADER_DATE] = '{0}'.format(cdate) - elif hdr_key == HEADER_DIGEST.lower(): - request_body = body.encode() - body_digest, digest_prefix = self._get_message_digest(request_body) - b64_body_digest = b64encode(body_digest.digest()) - value = digest_prefix + b64_body_digest.decode('ascii') - request_headers_dict[HEADER_DIGEST] = '{0}{1}'.format( - digest_prefix, b64_body_digest.decode('ascii')) - elif hdr_key == HEADER_HOST.lower(): - value = target_host - request_headers_dict[HEADER_HOST] = '{0}'.format(target_host) - else: - value = next((v for k, v in headers.items() if k.lower() == hdr_key), None) - if value is None: - raise Exception( - "Cannot sign HTTP request. " - "Request does not contain the '{0}' header".format(hdr_key)) - signed_headers_list.append((hdr_key, value)) - - return signed_headers_list, request_headers_dict - - def _get_message_digest(self, data): - """Calculates and returns a cryptographic digest of a specified HTTP request. - - :param data: The string representation of the date to be hashed with a cryptographic hash. - :return: A tuple of (digest, prefix). - The digest is a hashing object that contains the cryptographic digest of - the HTTP request. - The prefix is a string that identifies the cryptographic hash. It is used - to generate the 'Digest' header as specified in RFC 3230. - """ - if self.hash_algorithm == HASH_SHA512: - digest = SHA512.new() - prefix = 'SHA-512=' - elif self.hash_algorithm == HASH_SHA256: - digest = SHA256.new() - prefix = 'SHA-256=' - else: - raise Exception("Unsupported hash algorithm: {0}".format(self.hash_algorithm)) - digest.update(data) - return digest, prefix - - def _sign_digest(self, digest): - """Signs a message digest with a private key specified in the signing_info. - - :param digest: A hashing object that contains the cryptographic digest of the HTTP request. - :return: A base-64 string representing the cryptographic signature of the input digest. - """ - sig_alg = self.signing_algorithm - if isinstance(self.private_key, RSA.RsaKey): - if sig_alg is None or sig_alg == ALGORITHM_RSASSA_PSS: - # RSASSA-PSS in Section 8.1 of RFC8017. - signature = pss.new(self.private_key).sign(digest) - elif sig_alg == ALGORITHM_RSASSA_PKCS1v15: - # RSASSA-PKCS1-v1_5 in Section 8.2 of RFC8017. - signature = PKCS1_v1_5.new(self.private_key).sign(digest) - else: - raise Exception("Unsupported signature algorithm: {0}".format(sig_alg)) - elif isinstance(self.private_key, ECC.EccKey): - if sig_alg is None: - sig_alg = ALGORITHM_ECDSA_MODE_FIPS_186_3 - if sig_alg in ALGORITHM_ECDSA_KEY_SIGNING_ALGORITHMS: - # draft-ietf-httpbis-message-signatures-00 does not specify the ECDSA encoding. - # Issue: https://github.com/w3c-ccg/http-signatures/issues/107 - signature = DSS.new(key=self.private_key, mode=sig_alg, - encoding='der').sign(digest) - else: - raise Exception("Unsupported signature algorithm: {0}".format(sig_alg)) - else: - raise Exception("Unsupported private key: {0}".format(type(self.private_key))) - return b64encode(signature) - - def _get_authorization_header(self, signed_headers, signed_msg): - """Calculates and returns the value of the 'Authorization' header when signing HTTP requests. - - :param signed_headers : A list of tuples. Each value is the name of a HTTP header that - must be included in the HTTP signature calculation. - :param signed_msg: A base-64 encoded string representation of the signature. - :return: The string value of the 'Authorization' header, representing the signature - of the HTTP request. - """ - created_ts = None - expires_ts = None - for k, v in signed_headers: - if k == HEADER_CREATED: - created_ts = v - elif k == HEADER_EXPIRES: - expires_ts = v - lower_keys = [k.lower() for k, v in signed_headers] - headers_value = " ".join(lower_keys) - - auth_str = "Signature keyId=\"{0}\",algorithm=\"{1}\",".format( - self.key_id, self.signing_scheme) - if created_ts is not None: - auth_str = auth_str + "created={0},".format(created_ts) - if expires_ts is not None: - auth_str = auth_str + "expires={0},".format(expires_ts) - auth_str = auth_str + "headers=\"{0}\",signature=\"{1}\"".format( - headers_value, signed_msg.decode('ascii')) - - return auth_str diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/pyproject.toml b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/pyproject.toml deleted file mode 100644 index 8c0a993b36fa..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/pyproject.toml +++ /dev/null @@ -1,33 +0,0 @@ -[tool.poetry] -name = "petstore_api" -version = "1.0.0" -description = "OpenAPI Petstore" -authors = ["OpenAPI Generator Community "] -license = "Apache-2.0" -readme = "README.md" -repository = "https://github.com/GIT_USER_ID/GIT_REPO_ID" -keywords = ["OpenAPI", "OpenAPI-Generator", "OpenAPI Petstore"] -include = ["petstore_api/py.typed"] - -[tool.poetry.dependencies] -python = "^3.7" - -urllib3 = ">= 1.25.3" -python-dateutil = ">=2.8.2" -aiohttp = ">= 3.8.4" -pem = ">= 19.3.0" -pycryptodome = ">= 3.9.0" -pydantic = "^1.10.5, <2" -aenum = ">=3.1.11" - -[tool.poetry.dev-dependencies] -pytest = ">=7.2.1" -tox = ">=3.9.0" -flake8 = ">=4.0.0" - -[build-system] -requires = ["setuptools"] -build-backend = "setuptools.build_meta" - -[tool.pylint.'MESSAGES CONTROL'] -extension-pkg-whitelist = "pydantic" diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/requirements.txt b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/requirements.txt deleted file mode 100644 index bd242be2a0f4..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/requirements.txt +++ /dev/null @@ -1,7 +0,0 @@ -python_dateutil >= 2.5.3 -setuptools >= 21.0.0 -urllib3 >= 1.25.3, < 2.1.0 -pydantic >= 1.10.5, < 2 -aenum >= 3.1.11 -aiohttp >= 3.0.0 -pycryptodome >= 3.9.0 diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/setup.cfg b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/setup.cfg deleted file mode 100644 index 11433ee875ab..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/setup.cfg +++ /dev/null @@ -1,2 +0,0 @@ -[flake8] -max-line-length=99 diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/setup.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/setup.py deleted file mode 100644 index e5b090da62b1..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/setup.py +++ /dev/null @@ -1,53 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from setuptools import setup, find_packages # noqa: H301 - -# To install the library, run the following -# -# python setup.py install -# -# prerequisite: setuptools -# http://pypi.python.org/pypi/setuptools -NAME = "petstore-api" -VERSION = "1.0.0" -PYTHON_REQUIRES = ">=3.7" -REQUIRES = [ - "urllib3 >= 1.25.3, < 2.1.0", - "python-dateutil", - "aiohttp >= 3.0.0", - "pem>=19.3.0", - "pycryptodome>=3.9.0", - "pydantic >= 1.10.5, < 2", - "aenum" -] - -setup( - name=NAME, - version=VERSION, - description="OpenAPI Petstore", - author="OpenAPI Generator community", - author_email="team@openapitools.org", - url="", - keywords=["OpenAPI", "OpenAPI-Generator", "OpenAPI Petstore"], - install_requires=REQUIRES, - packages=find_packages(exclude=["test", "tests"]), - include_package_data=True, - license="Apache-2.0", - long_description_content_type='text/markdown', - 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: \" \\ - """, # noqa: E501 - package_data={"petstore_api": ["py.typed"]}, -) diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test-requirements.txt b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test-requirements.txt deleted file mode 100644 index 3a0d0b939a1e..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test-requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -pytest~=7.1.3 -pytest-cov>=2.8.1 -pytest-randomly>=3.12.0 diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/__init__.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/__init__.py deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_additional_properties_any_type.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_additional_properties_any_type.py deleted file mode 100644 index a1669f0664d2..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_additional_properties_any_type.py +++ /dev/null @@ -1,52 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.additional_properties_any_type import AdditionalPropertiesAnyType # noqa: E501 - -class TestAdditionalPropertiesAnyType(unittest.TestCase): - """AdditionalPropertiesAnyType unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> AdditionalPropertiesAnyType: - """Test AdditionalPropertiesAnyType - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `AdditionalPropertiesAnyType` - """ - model = AdditionalPropertiesAnyType() # noqa: E501 - if include_optional: - return AdditionalPropertiesAnyType( - name = '' - ) - else: - return AdditionalPropertiesAnyType( - ) - """ - - def testAdditionalPropertiesAnyType(self): - """Test AdditionalPropertiesAnyType""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_additional_properties_class.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_additional_properties_class.py deleted file mode 100644 index d1dc12c44584..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_additional_properties_class.py +++ /dev/null @@ -1,59 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.additional_properties_class import AdditionalPropertiesClass # noqa: E501 - -class TestAdditionalPropertiesClass(unittest.TestCase): - """AdditionalPropertiesClass unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> AdditionalPropertiesClass: - """Test AdditionalPropertiesClass - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `AdditionalPropertiesClass` - """ - model = AdditionalPropertiesClass() # noqa: E501 - if include_optional: - return AdditionalPropertiesClass( - map_property = { - 'key' : '' - }, - map_of_map_property = { - 'key' : { - 'key' : '' - } - } - ) - else: - return AdditionalPropertiesClass( - ) - """ - - def testAdditionalPropertiesClass(self): - """Test AdditionalPropertiesClass""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_additional_properties_object.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_additional_properties_object.py deleted file mode 100644 index 9bfa2a0cde83..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_additional_properties_object.py +++ /dev/null @@ -1,52 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.additional_properties_object import AdditionalPropertiesObject # noqa: E501 - -class TestAdditionalPropertiesObject(unittest.TestCase): - """AdditionalPropertiesObject unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> AdditionalPropertiesObject: - """Test AdditionalPropertiesObject - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `AdditionalPropertiesObject` - """ - model = AdditionalPropertiesObject() # noqa: E501 - if include_optional: - return AdditionalPropertiesObject( - name = '' - ) - else: - return AdditionalPropertiesObject( - ) - """ - - def testAdditionalPropertiesObject(self): - """Test AdditionalPropertiesObject""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_additional_properties_with_description_only.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_additional_properties_with_description_only.py deleted file mode 100644 index 88df1cc92955..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_additional_properties_with_description_only.py +++ /dev/null @@ -1,52 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.additional_properties_with_description_only import AdditionalPropertiesWithDescriptionOnly # noqa: E501 - -class TestAdditionalPropertiesWithDescriptionOnly(unittest.TestCase): - """AdditionalPropertiesWithDescriptionOnly unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> AdditionalPropertiesWithDescriptionOnly: - """Test AdditionalPropertiesWithDescriptionOnly - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `AdditionalPropertiesWithDescriptionOnly` - """ - model = AdditionalPropertiesWithDescriptionOnly() # noqa: E501 - if include_optional: - return AdditionalPropertiesWithDescriptionOnly( - name = '' - ) - else: - return AdditionalPropertiesWithDescriptionOnly( - ) - """ - - def testAdditionalPropertiesWithDescriptionOnly(self): - """Test AdditionalPropertiesWithDescriptionOnly""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_all_of_with_single_ref.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_all_of_with_single_ref.py deleted file mode 100644 index 920ad3782e15..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_all_of_with_single_ref.py +++ /dev/null @@ -1,53 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.all_of_with_single_ref import AllOfWithSingleRef # noqa: E501 - -class TestAllOfWithSingleRef(unittest.TestCase): - """AllOfWithSingleRef unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> AllOfWithSingleRef: - """Test AllOfWithSingleRef - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `AllOfWithSingleRef` - """ - model = AllOfWithSingleRef() # noqa: E501 - if include_optional: - return AllOfWithSingleRef( - username = '', - single_ref_type = 'admin' - ) - else: - return AllOfWithSingleRef( - ) - """ - - def testAllOfWithSingleRef(self): - """Test AllOfWithSingleRef""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_animal.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_animal.py deleted file mode 100644 index b0b62a0bb2b3..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_animal.py +++ /dev/null @@ -1,54 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.animal import Animal # noqa: E501 - -class TestAnimal(unittest.TestCase): - """Animal unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> Animal: - """Test Animal - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `Animal` - """ - model = Animal() # noqa: E501 - if include_optional: - return Animal( - class_name = '', - color = 'red' - ) - else: - return Animal( - class_name = '', - ) - """ - - def testAnimal(self): - """Test Animal""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_another_fake_api.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_another_fake_api.py deleted file mode 100644 index a6070f5b5f54..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_another_fake_api.py +++ /dev/null @@ -1,38 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest - -from petstore_api.api.another_fake_api import AnotherFakeApi # noqa: E501 - - -class TestAnotherFakeApi(unittest.TestCase): - """AnotherFakeApi unit test stubs""" - - def setUp(self) -> None: - self.api = AnotherFakeApi() # noqa: E501 - - def tearDown(self) -> None: - pass - - def test_call_123_test_special_tags(self) -> None: - """Test case for call_123_test_special_tags - - To test special tags # noqa: E501 - """ - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_any_of_color.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_any_of_color.py deleted file mode 100644 index f99dfd0020b1..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_any_of_color.py +++ /dev/null @@ -1,51 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.any_of_color import AnyOfColor # noqa: E501 - -class TestAnyOfColor(unittest.TestCase): - """AnyOfColor unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> AnyOfColor: - """Test AnyOfColor - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `AnyOfColor` - """ - model = AnyOfColor() # noqa: E501 - if include_optional: - return AnyOfColor( - ) - else: - return AnyOfColor( - ) - """ - - def testAnyOfColor(self): - """Test AnyOfColor""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_any_of_pig.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_any_of_pig.py deleted file mode 100644 index c3e4760182c5..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_any_of_pig.py +++ /dev/null @@ -1,57 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.any_of_pig import AnyOfPig # noqa: E501 - -class TestAnyOfPig(unittest.TestCase): - """AnyOfPig unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> AnyOfPig: - """Test AnyOfPig - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `AnyOfPig` - """ - model = AnyOfPig() # noqa: E501 - if include_optional: - return AnyOfPig( - class_name = '', - color = '', - size = 56 - ) - else: - return AnyOfPig( - class_name = '', - color = '', - size = 56, - ) - """ - - def testAnyOfPig(self): - """Test AnyOfPig""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_api_response.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_api_response.py deleted file mode 100644 index 9882aa1b9005..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_api_response.py +++ /dev/null @@ -1,54 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.api_response import ApiResponse # noqa: E501 - -class TestApiResponse(unittest.TestCase): - """ApiResponse unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> ApiResponse: - """Test ApiResponse - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `ApiResponse` - """ - model = ApiResponse() # noqa: E501 - if include_optional: - return ApiResponse( - code = 56, - type = '', - message = '' - ) - else: - return ApiResponse( - ) - """ - - def testApiResponse(self): - """Test ApiResponse""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_array_of_array_of_model.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_array_of_array_of_model.py deleted file mode 100644 index 7c0809b0b233..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_array_of_array_of_model.py +++ /dev/null @@ -1,58 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.array_of_array_of_model import ArrayOfArrayOfModel # noqa: E501 - -class TestArrayOfArrayOfModel(unittest.TestCase): - """ArrayOfArrayOfModel unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> ArrayOfArrayOfModel: - """Test ArrayOfArrayOfModel - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `ArrayOfArrayOfModel` - """ - model = ArrayOfArrayOfModel() # noqa: E501 - if include_optional: - return ArrayOfArrayOfModel( - another_property = [ - [ - petstore_api.models.tag.Tag( - id = 56, - name = '', ) - ] - ] - ) - else: - return ArrayOfArrayOfModel( - ) - """ - - def testArrayOfArrayOfModel(self): - """Test ArrayOfArrayOfModel""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_array_of_array_of_number_only.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_array_of_array_of_number_only.py deleted file mode 100644 index 22160c2bd055..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_array_of_array_of_number_only.py +++ /dev/null @@ -1,56 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.array_of_array_of_number_only import ArrayOfArrayOfNumberOnly # noqa: E501 - -class TestArrayOfArrayOfNumberOnly(unittest.TestCase): - """ArrayOfArrayOfNumberOnly unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> ArrayOfArrayOfNumberOnly: - """Test ArrayOfArrayOfNumberOnly - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `ArrayOfArrayOfNumberOnly` - """ - model = ArrayOfArrayOfNumberOnly() # noqa: E501 - if include_optional: - return ArrayOfArrayOfNumberOnly( - array_array_number = [ - [ - 1.337 - ] - ] - ) - else: - return ArrayOfArrayOfNumberOnly( - ) - """ - - def testArrayOfArrayOfNumberOnly(self): - """Test ArrayOfArrayOfNumberOnly""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_array_of_number_only.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_array_of_number_only.py deleted file mode 100644 index ade32f4f8f21..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_array_of_number_only.py +++ /dev/null @@ -1,54 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.array_of_number_only import ArrayOfNumberOnly # noqa: E501 - -class TestArrayOfNumberOnly(unittest.TestCase): - """ArrayOfNumberOnly unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> ArrayOfNumberOnly: - """Test ArrayOfNumberOnly - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `ArrayOfNumberOnly` - """ - model = ArrayOfNumberOnly() # noqa: E501 - if include_optional: - return ArrayOfNumberOnly( - array_number = [ - 1.337 - ] - ) - else: - return ArrayOfNumberOnly( - ) - """ - - def testArrayOfNumberOnly(self): - """Test ArrayOfNumberOnly""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_array_test.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_array_test.py deleted file mode 100644 index dc20a60413cd..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_array_test.py +++ /dev/null @@ -1,66 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.array_test import ArrayTest # noqa: E501 - -class TestArrayTest(unittest.TestCase): - """ArrayTest unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> ArrayTest: - """Test ArrayTest - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `ArrayTest` - """ - model = ArrayTest() # noqa: E501 - if include_optional: - return ArrayTest( - array_of_string = [ - '' - ], - array_array_of_integer = [ - [ - 56 - ] - ], - array_array_of_model = [ - [ - petstore_api.models.read_only_first.ReadOnlyFirst( - bar = '', - baz = '', ) - ] - ] - ) - else: - return ArrayTest( - ) - """ - - def testArrayTest(self): - """Test ArrayTest""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_basque_pig.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_basque_pig.py deleted file mode 100644 index 42f62fa31115..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_basque_pig.py +++ /dev/null @@ -1,55 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.basque_pig import BasquePig # noqa: E501 - -class TestBasquePig(unittest.TestCase): - """BasquePig unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> BasquePig: - """Test BasquePig - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `BasquePig` - """ - model = BasquePig() # noqa: E501 - if include_optional: - return BasquePig( - class_name = '', - color = '' - ) - else: - return BasquePig( - class_name = '', - color = '', - ) - """ - - def testBasquePig(self): - """Test BasquePig""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_capitalization.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_capitalization.py deleted file mode 100644 index 17b75e51e363..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_capitalization.py +++ /dev/null @@ -1,57 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.capitalization import Capitalization # noqa: E501 - -class TestCapitalization(unittest.TestCase): - """Capitalization unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> Capitalization: - """Test Capitalization - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `Capitalization` - """ - model = Capitalization() # noqa: E501 - if include_optional: - return Capitalization( - small_camel = '', - capital_camel = '', - small_snake = '', - capital_snake = '', - sca_eth_flow_points = '', - att_name = '' - ) - else: - return Capitalization( - ) - """ - - def testCapitalization(self): - """Test Capitalization""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_cat.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_cat.py deleted file mode 100644 index 58e743f44c86..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_cat.py +++ /dev/null @@ -1,52 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.cat import Cat # noqa: E501 - -class TestCat(unittest.TestCase): - """Cat unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> Cat: - """Test Cat - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `Cat` - """ - model = Cat() # noqa: E501 - if include_optional: - return Cat( - declawed = True - ) - else: - return Cat( - ) - """ - - def testCat(self): - """Test Cat""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_category.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_category.py deleted file mode 100644 index 2a287246f81a..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_category.py +++ /dev/null @@ -1,54 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.category import Category # noqa: E501 - -class TestCategory(unittest.TestCase): - """Category unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> Category: - """Test Category - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `Category` - """ - model = Category() # noqa: E501 - if include_optional: - return Category( - id = 56, - name = 'default-name' - ) - else: - return Category( - name = 'default-name', - ) - """ - - def testCategory(self): - """Test Category""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_circular_reference_model.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_circular_reference_model.py deleted file mode 100644 index f23f02000225..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_circular_reference_model.py +++ /dev/null @@ -1,60 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.circular_reference_model import CircularReferenceModel # noqa: E501 - -class TestCircularReferenceModel(unittest.TestCase): - """CircularReferenceModel unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> CircularReferenceModel: - """Test CircularReferenceModel - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `CircularReferenceModel` - """ - model = CircularReferenceModel() # noqa: E501 - if include_optional: - return CircularReferenceModel( - size = 56, - nested = petstore_api.models.first_ref.FirstRef( - category = '', - self_ref = petstore_api.models.second_ref.SecondRef( - category = '', - circular_ref = petstore_api.models.circular_reference_model.Circular-Reference-Model( - size = 56, - nested = petstore_api.models.first_ref.FirstRef( - category = '', ), ), ), ) - ) - else: - return CircularReferenceModel( - ) - """ - - def testCircularReferenceModel(self): - """Test CircularReferenceModel""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_class_model.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_class_model.py deleted file mode 100644 index 6b78a1941820..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_class_model.py +++ /dev/null @@ -1,52 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.class_model import ClassModel # noqa: E501 - -class TestClassModel(unittest.TestCase): - """ClassModel unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> ClassModel: - """Test ClassModel - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `ClassModel` - """ - model = ClassModel() # noqa: E501 - if include_optional: - return ClassModel( - var_class = '' - ) - else: - return ClassModel( - ) - """ - - def testClassModel(self): - """Test ClassModel""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_client.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_client.py deleted file mode 100644 index 9d109601e811..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_client.py +++ /dev/null @@ -1,52 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.client import Client # noqa: E501 - -class TestClient(unittest.TestCase): - """Client unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> Client: - """Test Client - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `Client` - """ - model = Client() # noqa: E501 - if include_optional: - return Client( - client = '' - ) - else: - return Client( - ) - """ - - def testClient(self): - """Test Client""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_color.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_color.py deleted file mode 100644 index 21f53552b360..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_color.py +++ /dev/null @@ -1,51 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.color import Color # noqa: E501 - -class TestColor(unittest.TestCase): - """Color unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> Color: - """Test Color - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `Color` - """ - model = Color() # noqa: E501 - if include_optional: - return Color( - ) - else: - return Color( - ) - """ - - def testColor(self): - """Test Color""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_creature.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_creature.py deleted file mode 100644 index af6b9ef7b311..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_creature.py +++ /dev/null @@ -1,57 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.creature import Creature # noqa: E501 - -class TestCreature(unittest.TestCase): - """Creature unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> Creature: - """Test Creature - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `Creature` - """ - model = Creature() # noqa: E501 - if include_optional: - return Creature( - info = petstore_api.models.creature_info.CreatureInfo( - name = '', ), - type = '' - ) - else: - return Creature( - info = petstore_api.models.creature_info.CreatureInfo( - name = '', ), - type = '', - ) - """ - - def testCreature(self): - """Test Creature""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_creature_info.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_creature_info.py deleted file mode 100644 index a95dfd3d922b..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_creature_info.py +++ /dev/null @@ -1,53 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.creature_info import CreatureInfo # noqa: E501 - -class TestCreatureInfo(unittest.TestCase): - """CreatureInfo unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> CreatureInfo: - """Test CreatureInfo - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `CreatureInfo` - """ - model = CreatureInfo() # noqa: E501 - if include_optional: - return CreatureInfo( - name = '' - ) - else: - return CreatureInfo( - name = '', - ) - """ - - def testCreatureInfo(self): - """Test CreatureInfo""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_danish_pig.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_danish_pig.py deleted file mode 100644 index bbd0ffcb5f01..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_danish_pig.py +++ /dev/null @@ -1,55 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.danish_pig import DanishPig # noqa: E501 - -class TestDanishPig(unittest.TestCase): - """DanishPig unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> DanishPig: - """Test DanishPig - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `DanishPig` - """ - model = DanishPig() # noqa: E501 - if include_optional: - return DanishPig( - class_name = '', - size = 56 - ) - else: - return DanishPig( - class_name = '', - size = 56, - ) - """ - - def testDanishPig(self): - """Test DanishPig""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_default_api.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_default_api.py deleted file mode 100644 index 2d9b266a7258..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_default_api.py +++ /dev/null @@ -1,37 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest - -from petstore_api.api.default_api import DefaultApi # noqa: E501 - - -class TestDefaultApi(unittest.TestCase): - """DefaultApi unit test stubs""" - - def setUp(self) -> None: - self.api = DefaultApi() # noqa: E501 - - def tearDown(self) -> None: - pass - - def test_foo_get(self) -> None: - """Test case for foo_get - - """ - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_deprecated_object.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_deprecated_object.py deleted file mode 100644 index ba3a63c719de..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_deprecated_object.py +++ /dev/null @@ -1,52 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.deprecated_object import DeprecatedObject # noqa: E501 - -class TestDeprecatedObject(unittest.TestCase): - """DeprecatedObject unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> DeprecatedObject: - """Test DeprecatedObject - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `DeprecatedObject` - """ - model = DeprecatedObject() # noqa: E501 - if include_optional: - return DeprecatedObject( - name = '' - ) - else: - return DeprecatedObject( - ) - """ - - def testDeprecatedObject(self): - """Test DeprecatedObject""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_dog.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_dog.py deleted file mode 100644 index d8a51df906c0..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_dog.py +++ /dev/null @@ -1,52 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.dog import Dog # noqa: E501 - -class TestDog(unittest.TestCase): - """Dog unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> Dog: - """Test Dog - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `Dog` - """ - model = Dog() # noqa: E501 - if include_optional: - return Dog( - breed = '' - ) - else: - return Dog( - ) - """ - - def testDog(self): - """Test Dog""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_dummy_model.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_dummy_model.py deleted file mode 100644 index 45459b666b16..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_dummy_model.py +++ /dev/null @@ -1,56 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.dummy_model import DummyModel # noqa: E501 - -class TestDummyModel(unittest.TestCase): - """DummyModel unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> DummyModel: - """Test DummyModel - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `DummyModel` - """ - model = DummyModel() # noqa: E501 - if include_optional: - return DummyModel( - category = '', - self_ref = petstore_api.models.self_reference_model.Self-Reference-Model( - size = 56, - nested = petstore_api.models.dummy_model.Dummy-Model( - category = '', ), ) - ) - else: - return DummyModel( - ) - """ - - def testDummyModel(self): - """Test DummyModel""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_enum_arrays.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_enum_arrays.py deleted file mode 100644 index 21e4cf531c4e..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_enum_arrays.py +++ /dev/null @@ -1,55 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.enum_arrays import EnumArrays # noqa: E501 - -class TestEnumArrays(unittest.TestCase): - """EnumArrays unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> EnumArrays: - """Test EnumArrays - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `EnumArrays` - """ - model = EnumArrays() # noqa: E501 - if include_optional: - return EnumArrays( - just_symbol = '>=', - array_enum = [ - 'fish' - ] - ) - else: - return EnumArrays( - ) - """ - - def testEnumArrays(self): - """Test EnumArrays""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_enum_class.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_enum_class.py deleted file mode 100644 index 92822bcdd970..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_enum_class.py +++ /dev/null @@ -1,34 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.enum_class import EnumClass # noqa: E501 - -class TestEnumClass(unittest.TestCase): - """EnumClass unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testEnumClass(self): - """Test EnumClass""" - # inst = EnumClass() - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_enum_string1.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_enum_string1.py deleted file mode 100644 index 9cbeacbe344d..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_enum_string1.py +++ /dev/null @@ -1,34 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.enum_string1 import EnumString1 # noqa: E501 - -class TestEnumString1(unittest.TestCase): - """EnumString1 unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testEnumString1(self): - """Test EnumString1""" - # inst = EnumString1() - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_enum_string2.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_enum_string2.py deleted file mode 100644 index 409c7f257a58..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_enum_string2.py +++ /dev/null @@ -1,34 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.enum_string2 import EnumString2 # noqa: E501 - -class TestEnumString2(unittest.TestCase): - """EnumString2 unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testEnumString2(self): - """Test EnumString2""" - # inst = EnumString2() - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_enum_test.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_enum_test.py deleted file mode 100644 index b706fa63df22..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_enum_test.py +++ /dev/null @@ -1,61 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.enum_test import EnumTest # noqa: E501 - -class TestEnumTest(unittest.TestCase): - """EnumTest unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> EnumTest: - """Test EnumTest - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `EnumTest` - """ - model = EnumTest() # noqa: E501 - if include_optional: - return EnumTest( - enum_string = 'UPPER', - enum_string_required = 'UPPER', - enum_integer_default = 1, - enum_integer = 1, - enum_number = 1.1, - outer_enum = 'placed', - outer_enum_integer = 2, - outer_enum_default_value = 'placed', - outer_enum_integer_default_value = -1 - ) - else: - return EnumTest( - enum_string_required = 'UPPER', - ) - """ - - def testEnumTest(self): - """Test EnumTest""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_fake_api.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_fake_api.py deleted file mode 100644 index 0d3fca3d7556..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_fake_api.py +++ /dev/null @@ -1,175 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest - -from petstore_api.api.fake_api import FakeApi # noqa: E501 - - -class TestFakeApi(unittest.TestCase): - """FakeApi unit test stubs""" - - def setUp(self) -> None: - self.api = FakeApi() # noqa: E501 - - def tearDown(self) -> None: - pass - - def test_fake_any_type_request_body(self) -> None: - """Test case for fake_any_type_request_body - - test any type request body # noqa: E501 - """ - pass - - def test_fake_enum_ref_query_parameter(self) -> None: - """Test case for fake_enum_ref_query_parameter - - test enum reference query parameter # noqa: E501 - """ - pass - - def test_fake_health_get(self) -> None: - """Test case for fake_health_get - - Health check endpoint # noqa: E501 - """ - pass - - def test_fake_http_signature_test(self) -> None: - """Test case for fake_http_signature_test - - test http signature authentication # noqa: E501 - """ - pass - - def test_fake_outer_boolean_serialize(self) -> None: - """Test case for fake_outer_boolean_serialize - - """ - pass - - def test_fake_outer_composite_serialize(self) -> None: - """Test case for fake_outer_composite_serialize - - """ - pass - - def test_fake_outer_number_serialize(self) -> None: - """Test case for fake_outer_number_serialize - - """ - pass - - def test_fake_outer_string_serialize(self) -> None: - """Test case for fake_outer_string_serialize - - """ - pass - - def test_fake_property_enum_integer_serialize(self) -> None: - """Test case for fake_property_enum_integer_serialize - - """ - pass - - def test_fake_return_list_of_objects(self) -> None: - """Test case for fake_return_list_of_objects - - test returning list of objects # noqa: E501 - """ - pass - - def test_fake_uuid_example(self) -> None: - """Test case for fake_uuid_example - - test uuid example # noqa: E501 - """ - pass - - def test_test_body_with_binary(self) -> None: - """Test case for test_body_with_binary - - """ - pass - - def test_test_body_with_file_schema(self) -> None: - """Test case for test_body_with_file_schema - - """ - pass - - def test_test_body_with_query_params(self) -> None: - """Test case for test_body_with_query_params - - """ - pass - - def test_test_client_model(self) -> None: - """Test case for test_client_model - - To test \"client\" model # noqa: E501 - """ - pass - - def test_test_date_time_query_parameter(self) -> None: - """Test case for test_date_time_query_parameter - - """ - pass - - def test_test_endpoint_parameters(self) -> None: - """Test case for test_endpoint_parameters - - Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501 - """ - pass - - def test_test_group_parameters(self) -> None: - """Test case for test_group_parameters - - Fake endpoint to test group parameters (optional) # noqa: E501 - """ - pass - - def test_test_inline_additional_properties(self) -> None: - """Test case for test_inline_additional_properties - - test inline additionalProperties # noqa: E501 - """ - pass - - def test_test_inline_freeform_additional_properties(self) -> None: - """Test case for test_inline_freeform_additional_properties - - test inline free-form additionalProperties # noqa: E501 - """ - pass - - def test_test_json_form_data(self) -> None: - """Test case for test_json_form_data - - test json serialization of form data # noqa: E501 - """ - pass - - def test_test_query_parameter_collection_format(self) -> None: - """Test case for test_query_parameter_collection_format - - """ - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_fake_classname_tags123_api.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_fake_classname_tags123_api.py deleted file mode 100644 index 25088624aea3..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_fake_classname_tags123_api.py +++ /dev/null @@ -1,38 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest - -from petstore_api.api.fake_classname_tags123_api import FakeClassnameTags123Api # noqa: E501 - - -class TestFakeClassnameTags123Api(unittest.TestCase): - """FakeClassnameTags123Api unit test stubs""" - - def setUp(self) -> None: - self.api = FakeClassnameTags123Api() # noqa: E501 - - def tearDown(self) -> None: - pass - - def test_test_classname(self) -> None: - """Test case for test_classname - - To test class name in snake case # noqa: E501 - """ - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_file.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_file.py deleted file mode 100644 index 0896f1869db5..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_file.py +++ /dev/null @@ -1,52 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.file import File # noqa: E501 - -class TestFile(unittest.TestCase): - """File unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> File: - """Test File - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `File` - """ - model = File() # noqa: E501 - if include_optional: - return File( - source_uri = '' - ) - else: - return File( - ) - """ - - def testFile(self): - """Test File""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_file_schema_test_class.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_file_schema_test_class.py deleted file mode 100644 index 72963bf91d52..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_file_schema_test_class.py +++ /dev/null @@ -1,57 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.file_schema_test_class import FileSchemaTestClass # noqa: E501 - -class TestFileSchemaTestClass(unittest.TestCase): - """FileSchemaTestClass unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> FileSchemaTestClass: - """Test FileSchemaTestClass - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `FileSchemaTestClass` - """ - model = FileSchemaTestClass() # noqa: E501 - if include_optional: - return FileSchemaTestClass( - file = petstore_api.models.file.File( - source_uri = '', ), - files = [ - petstore_api.models.file.File( - source_uri = '', ) - ] - ) - else: - return FileSchemaTestClass( - ) - """ - - def testFileSchemaTestClass(self): - """Test FileSchemaTestClass""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_first_ref.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_first_ref.py deleted file mode 100644 index a99fc7cfc796..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_first_ref.py +++ /dev/null @@ -1,58 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.first_ref import FirstRef # noqa: E501 - -class TestFirstRef(unittest.TestCase): - """FirstRef unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> FirstRef: - """Test FirstRef - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `FirstRef` - """ - model = FirstRef() # noqa: E501 - if include_optional: - return FirstRef( - category = '', - self_ref = petstore_api.models.second_ref.SecondRef( - category = '', - circular_ref = petstore_api.models.circular_reference_model.Circular-Reference-Model( - size = 56, - nested = petstore_api.models.first_ref.FirstRef( - category = '', ), ), ) - ) - else: - return FirstRef( - ) - """ - - def testFirstRef(self): - """Test FirstRef""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_foo.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_foo.py deleted file mode 100644 index f92679671c7a..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_foo.py +++ /dev/null @@ -1,52 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.foo import Foo # noqa: E501 - -class TestFoo(unittest.TestCase): - """Foo unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> Foo: - """Test Foo - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `Foo` - """ - model = Foo() # noqa: E501 - if include_optional: - return Foo( - bar = 'bar' - ) - else: - return Foo( - ) - """ - - def testFoo(self): - """Test Foo""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_foo_get_default_response.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_foo_get_default_response.py deleted file mode 100644 index 3a024f8e6c70..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_foo_get_default_response.py +++ /dev/null @@ -1,53 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.foo_get_default_response import FooGetDefaultResponse # noqa: E501 - -class TestFooGetDefaultResponse(unittest.TestCase): - """FooGetDefaultResponse unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> FooGetDefaultResponse: - """Test FooGetDefaultResponse - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `FooGetDefaultResponse` - """ - model = FooGetDefaultResponse() # noqa: E501 - if include_optional: - return FooGetDefaultResponse( - string = petstore_api.models.foo.Foo( - bar = 'bar', ) - ) - else: - return FooGetDefaultResponse( - ) - """ - - def testFooGetDefaultResponse(self): - """Test FooGetDefaultResponse""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_format_test.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_format_test.py deleted file mode 100644 index 72c8965d4914..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_format_test.py +++ /dev/null @@ -1,71 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.format_test import FormatTest # noqa: E501 - -class TestFormatTest(unittest.TestCase): - """FormatTest unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> FormatTest: - """Test FormatTest - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `FormatTest` - """ - model = FormatTest() # noqa: E501 - if include_optional: - return FormatTest( - integer = 10, - int32 = 20, - int64 = 56, - number = 32.1, - float = 54.3, - double = 67.8, - decimal = 1, - string = 'a', - string_with_double_quote_pattern = 'this is \"something\"', - byte = 'YQ==', - binary = bytes(b'blah'), - var_date = datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date(), - date_time = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - uuid = '72f98069-206d-4f12-9f12-3d1e525a8e84', - password = '0123456789', - pattern_with_digits = '0480728880', - pattern_with_digits_and_delimiter = 'image_480' - ) - else: - return FormatTest( - number = 32.1, - var_date = datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date(), - password = '0123456789', - ) - """ - - def testFormatTest(self): - """Test FormatTest""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_has_only_read_only.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_has_only_read_only.py deleted file mode 100644 index f106dda48d7e..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_has_only_read_only.py +++ /dev/null @@ -1,53 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.has_only_read_only import HasOnlyReadOnly # noqa: E501 - -class TestHasOnlyReadOnly(unittest.TestCase): - """HasOnlyReadOnly unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> HasOnlyReadOnly: - """Test HasOnlyReadOnly - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `HasOnlyReadOnly` - """ - model = HasOnlyReadOnly() # noqa: E501 - if include_optional: - return HasOnlyReadOnly( - bar = '', - foo = '' - ) - else: - return HasOnlyReadOnly( - ) - """ - - def testHasOnlyReadOnly(self): - """Test HasOnlyReadOnly""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_health_check_result.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_health_check_result.py deleted file mode 100644 index 4f36cde5f8b5..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_health_check_result.py +++ /dev/null @@ -1,52 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.health_check_result import HealthCheckResult # noqa: E501 - -class TestHealthCheckResult(unittest.TestCase): - """HealthCheckResult unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> HealthCheckResult: - """Test HealthCheckResult - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `HealthCheckResult` - """ - model = HealthCheckResult() # noqa: E501 - if include_optional: - return HealthCheckResult( - nullable_message = '' - ) - else: - return HealthCheckResult( - ) - """ - - def testHealthCheckResult(self): - """Test HealthCheckResult""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_inner_dict_with_property.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_inner_dict_with_property.py deleted file mode 100644 index 1ba15fd984da..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_inner_dict_with_property.py +++ /dev/null @@ -1,52 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.inner_dict_with_property import InnerDictWithProperty # noqa: E501 - -class TestInnerDictWithProperty(unittest.TestCase): - """InnerDictWithProperty unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> InnerDictWithProperty: - """Test InnerDictWithProperty - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `InnerDictWithProperty` - """ - model = InnerDictWithProperty() # noqa: E501 - if include_optional: - return InnerDictWithProperty( - a_property = None - ) - else: - return InnerDictWithProperty( - ) - """ - - def testInnerDictWithProperty(self): - """Test InnerDictWithProperty""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_int_or_string.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_int_or_string.py deleted file mode 100644 index 41bf80d02cb5..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_int_or_string.py +++ /dev/null @@ -1,51 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.int_or_string import IntOrString # noqa: E501 - -class TestIntOrString(unittest.TestCase): - """IntOrString unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> IntOrString: - """Test IntOrString - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `IntOrString` - """ - model = IntOrString() # noqa: E501 - if include_optional: - return IntOrString( - ) - else: - return IntOrString( - ) - """ - - def testIntOrString(self): - """Test IntOrString""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_list.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_list.py deleted file mode 100644 index 63be8f9a3d3b..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_list.py +++ /dev/null @@ -1,52 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.list import List # noqa: E501 - -class TestList(unittest.TestCase): - """List unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> List: - """Test List - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `List` - """ - model = List() # noqa: E501 - if include_optional: - return List( - var_123_list = '' - ) - else: - return List( - ) - """ - - def testList(self): - """Test List""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_map_of_array_of_model.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_map_of_array_of_model.py deleted file mode 100644 index 2f88aa7935ad..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_map_of_array_of_model.py +++ /dev/null @@ -1,58 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.map_of_array_of_model import MapOfArrayOfModel # noqa: E501 - -class TestMapOfArrayOfModel(unittest.TestCase): - """MapOfArrayOfModel unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> MapOfArrayOfModel: - """Test MapOfArrayOfModel - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `MapOfArrayOfModel` - """ - model = MapOfArrayOfModel() # noqa: E501 - if include_optional: - return MapOfArrayOfModel( - shop_id_to_org_online_lip_map = { - 'key' : [ - petstore_api.models.tag.Tag( - id = 56, - name = '', ) - ] - } - ) - else: - return MapOfArrayOfModel( - ) - """ - - def testMapOfArrayOfModel(self): - """Test MapOfArrayOfModel""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_map_test.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_map_test.py deleted file mode 100644 index 8aedbfa8f665..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_map_test.py +++ /dev/null @@ -1,65 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.map_test import MapTest # noqa: E501 - -class TestMapTest(unittest.TestCase): - """MapTest unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> MapTest: - """Test MapTest - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `MapTest` - """ - model = MapTest() # noqa: E501 - if include_optional: - return MapTest( - map_map_of_string = { - 'key' : { - 'key' : '' - } - }, - map_of_enum_string = { - 'UPPER' : 'UPPER' - }, - direct_map = { - 'key' : True - }, - indirect_map = { - 'key' : True - } - ) - else: - return MapTest( - ) - """ - - def testMapTest(self): - """Test MapTest""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_mixed_properties_and_additional_properties_class.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_mixed_properties_and_additional_properties_class.py deleted file mode 100644 index 12a96998a561..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_mixed_properties_and_additional_properties_class.py +++ /dev/null @@ -1,58 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass # noqa: E501 - -class TestMixedPropertiesAndAdditionalPropertiesClass(unittest.TestCase): - """MixedPropertiesAndAdditionalPropertiesClass unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> MixedPropertiesAndAdditionalPropertiesClass: - """Test MixedPropertiesAndAdditionalPropertiesClass - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `MixedPropertiesAndAdditionalPropertiesClass` - """ - model = MixedPropertiesAndAdditionalPropertiesClass() # noqa: E501 - if include_optional: - return MixedPropertiesAndAdditionalPropertiesClass( - uuid = '', - date_time = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - map = { - 'key' : petstore_api.models.animal.Animal( - class_name = '', - color = 'red', ) - } - ) - else: - return MixedPropertiesAndAdditionalPropertiesClass( - ) - """ - - def testMixedPropertiesAndAdditionalPropertiesClass(self): - """Test MixedPropertiesAndAdditionalPropertiesClass""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_model200_response.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_model200_response.py deleted file mode 100644 index f5e65f1aca4e..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_model200_response.py +++ /dev/null @@ -1,53 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.model200_response import Model200Response # noqa: E501 - -class TestModel200Response(unittest.TestCase): - """Model200Response unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> Model200Response: - """Test Model200Response - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `Model200Response` - """ - model = Model200Response() # noqa: E501 - if include_optional: - return Model200Response( - name = 56, - var_class = '' - ) - else: - return Model200Response( - ) - """ - - def testModel200Response(self): - """Test Model200Response""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_model_return.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_model_return.py deleted file mode 100644 index e011892fb0b3..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_model_return.py +++ /dev/null @@ -1,52 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.model_return import ModelReturn # noqa: E501 - -class TestModelReturn(unittest.TestCase): - """ModelReturn unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> ModelReturn: - """Test ModelReturn - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `ModelReturn` - """ - model = ModelReturn() # noqa: E501 - if include_optional: - return ModelReturn( - var_return = 56 - ) - else: - return ModelReturn( - ) - """ - - def testModelReturn(self): - """Test ModelReturn""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_name.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_name.py deleted file mode 100644 index be7ddc8461d1..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_name.py +++ /dev/null @@ -1,56 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.name import Name # noqa: E501 - -class TestName(unittest.TestCase): - """Name unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> Name: - """Test Name - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `Name` - """ - model = Name() # noqa: E501 - if include_optional: - return Name( - name = 56, - snake_case = 56, - var_property = '', - var_123_number = 56 - ) - else: - return Name( - name = 56, - ) - """ - - def testName(self): - """Test Name""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_nullable_class.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_nullable_class.py deleted file mode 100644 index b1170db23c4d..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_nullable_class.py +++ /dev/null @@ -1,77 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.nullable_class import NullableClass # noqa: E501 - -class TestNullableClass(unittest.TestCase): - """NullableClass unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> NullableClass: - """Test NullableClass - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `NullableClass` - """ - model = NullableClass() # noqa: E501 - if include_optional: - return NullableClass( - required_integer_prop = 56, - integer_prop = 56, - number_prop = 1.337, - boolean_prop = True, - string_prop = '', - date_prop = datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date(), - datetime_prop = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - array_nullable_prop = [ - None - ], - array_and_items_nullable_prop = [ - None - ], - array_items_nullable = [ - None - ], - object_nullable_prop = { - 'key' : None - }, - object_and_items_nullable_prop = { - 'key' : None - }, - object_items_nullable = { - 'key' : None - } - ) - else: - return NullableClass( - required_integer_prop = 56, - ) - """ - - def testNullableClass(self): - """Test NullableClass""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_nullable_property.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_nullable_property.py deleted file mode 100644 index aa34b84e7973..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_nullable_property.py +++ /dev/null @@ -1,55 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.nullable_property import NullableProperty # noqa: E501 - -class TestNullableProperty(unittest.TestCase): - """NullableProperty unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> NullableProperty: - """Test NullableProperty - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `NullableProperty` - """ - model = NullableProperty() # noqa: E501 - if include_optional: - return NullableProperty( - id = 56, - name = 'AUR,rZ#UM/?R,Fp^l6$ARjbhJk C>' - ) - else: - return NullableProperty( - id = 56, - name = 'AUR,rZ#UM/?R,Fp^l6$ARjbhJk C>', - ) - """ - - def testNullableProperty(self): - """Test NullableProperty""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_number_only.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_number_only.py deleted file mode 100644 index cfc8c5c778c4..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_number_only.py +++ /dev/null @@ -1,52 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.number_only import NumberOnly # noqa: E501 - -class TestNumberOnly(unittest.TestCase): - """NumberOnly unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> NumberOnly: - """Test NumberOnly - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `NumberOnly` - """ - model = NumberOnly() # noqa: E501 - if include_optional: - return NumberOnly( - just_number = 1.337 - ) - else: - return NumberOnly( - ) - """ - - def testNumberOnly(self): - """Test NumberOnly""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_object_to_test_additional_properties.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_object_to_test_additional_properties.py deleted file mode 100644 index d080b21afb32..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_object_to_test_additional_properties.py +++ /dev/null @@ -1,52 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.object_to_test_additional_properties import ObjectToTestAdditionalProperties # noqa: E501 - -class TestObjectToTestAdditionalProperties(unittest.TestCase): - """ObjectToTestAdditionalProperties unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> ObjectToTestAdditionalProperties: - """Test ObjectToTestAdditionalProperties - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `ObjectToTestAdditionalProperties` - """ - model = ObjectToTestAdditionalProperties() # noqa: E501 - if include_optional: - return ObjectToTestAdditionalProperties( - var_property = True - ) - else: - return ObjectToTestAdditionalProperties( - ) - """ - - def testObjectToTestAdditionalProperties(self): - """Test ObjectToTestAdditionalProperties""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_object_with_deprecated_fields.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_object_with_deprecated_fields.py deleted file mode 100644 index 5f04c63a3cb3..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_object_with_deprecated_fields.py +++ /dev/null @@ -1,58 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.object_with_deprecated_fields import ObjectWithDeprecatedFields # noqa: E501 - -class TestObjectWithDeprecatedFields(unittest.TestCase): - """ObjectWithDeprecatedFields unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> ObjectWithDeprecatedFields: - """Test ObjectWithDeprecatedFields - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `ObjectWithDeprecatedFields` - """ - model = ObjectWithDeprecatedFields() # noqa: E501 - if include_optional: - return ObjectWithDeprecatedFields( - uuid = '', - id = 1.337, - deprecated_ref = petstore_api.models.deprecated_object.DeprecatedObject( - name = '', ), - bars = [ - 'bar' - ] - ) - else: - return ObjectWithDeprecatedFields( - ) - """ - - def testObjectWithDeprecatedFields(self): - """Test ObjectWithDeprecatedFields""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_one_of_enum_string.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_one_of_enum_string.py deleted file mode 100644 index 3db614a16caf..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_one_of_enum_string.py +++ /dev/null @@ -1,51 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.one_of_enum_string import OneOfEnumString # noqa: E501 - -class TestOneOfEnumString(unittest.TestCase): - """OneOfEnumString unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> OneOfEnumString: - """Test OneOfEnumString - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `OneOfEnumString` - """ - model = OneOfEnumString() # noqa: E501 - if include_optional: - return OneOfEnumString( - ) - else: - return OneOfEnumString( - ) - """ - - def testOneOfEnumString(self): - """Test OneOfEnumString""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_order.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_order.py deleted file mode 100644 index 3334ed8f949a..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_order.py +++ /dev/null @@ -1,57 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.order import Order # noqa: E501 - -class TestOrder(unittest.TestCase): - """Order unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> Order: - """Test Order - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `Order` - """ - model = Order() # noqa: E501 - if include_optional: - return Order( - id = 56, - pet_id = 56, - quantity = 56, - ship_date = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - status = 'placed', - complete = True - ) - else: - return Order( - ) - """ - - def testOrder(self): - """Test Order""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_outer_composite.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_outer_composite.py deleted file mode 100644 index 7df32d8c6725..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_outer_composite.py +++ /dev/null @@ -1,54 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.outer_composite import OuterComposite # noqa: E501 - -class TestOuterComposite(unittest.TestCase): - """OuterComposite unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> OuterComposite: - """Test OuterComposite - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `OuterComposite` - """ - model = OuterComposite() # noqa: E501 - if include_optional: - return OuterComposite( - my_number = 1.337, - my_string = '', - my_boolean = True - ) - else: - return OuterComposite( - ) - """ - - def testOuterComposite(self): - """Test OuterComposite""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_outer_enum.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_outer_enum.py deleted file mode 100644 index 5da04a9a45c0..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_outer_enum.py +++ /dev/null @@ -1,34 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.outer_enum import OuterEnum # noqa: E501 - -class TestOuterEnum(unittest.TestCase): - """OuterEnum unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testOuterEnum(self): - """Test OuterEnum""" - # inst = OuterEnum() - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_outer_enum_default_value.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_outer_enum_default_value.py deleted file mode 100644 index df6499565fdb..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_outer_enum_default_value.py +++ /dev/null @@ -1,34 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.outer_enum_default_value import OuterEnumDefaultValue # noqa: E501 - -class TestOuterEnumDefaultValue(unittest.TestCase): - """OuterEnumDefaultValue unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testOuterEnumDefaultValue(self): - """Test OuterEnumDefaultValue""" - # inst = OuterEnumDefaultValue() - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_outer_enum_integer.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_outer_enum_integer.py deleted file mode 100644 index 7b89b806ba24..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_outer_enum_integer.py +++ /dev/null @@ -1,34 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.outer_enum_integer import OuterEnumInteger # noqa: E501 - -class TestOuterEnumInteger(unittest.TestCase): - """OuterEnumInteger unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testOuterEnumInteger(self): - """Test OuterEnumInteger""" - # inst = OuterEnumInteger() - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_outer_enum_integer_default_value.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_outer_enum_integer_default_value.py deleted file mode 100644 index 532616fdee1f..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_outer_enum_integer_default_value.py +++ /dev/null @@ -1,34 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.outer_enum_integer_default_value import OuterEnumIntegerDefaultValue # noqa: E501 - -class TestOuterEnumIntegerDefaultValue(unittest.TestCase): - """OuterEnumIntegerDefaultValue unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testOuterEnumIntegerDefaultValue(self): - """Test OuterEnumIntegerDefaultValue""" - # inst = OuterEnumIntegerDefaultValue() - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_outer_object_with_enum_property.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_outer_object_with_enum_property.py deleted file mode 100644 index 27e518b00593..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_outer_object_with_enum_property.py +++ /dev/null @@ -1,54 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.outer_object_with_enum_property import OuterObjectWithEnumProperty # noqa: E501 - -class TestOuterObjectWithEnumProperty(unittest.TestCase): - """OuterObjectWithEnumProperty unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> OuterObjectWithEnumProperty: - """Test OuterObjectWithEnumProperty - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `OuterObjectWithEnumProperty` - """ - model = OuterObjectWithEnumProperty() # noqa: E501 - if include_optional: - return OuterObjectWithEnumProperty( - str_value = 'placed', - value = 2 - ) - else: - return OuterObjectWithEnumProperty( - value = 2, - ) - """ - - def testOuterObjectWithEnumProperty(self): - """Test OuterObjectWithEnumProperty""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_parent.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_parent.py deleted file mode 100644 index ea206970c9cf..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_parent.py +++ /dev/null @@ -1,55 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.parent import Parent # noqa: E501 - -class TestParent(unittest.TestCase): - """Parent unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> Parent: - """Test Parent - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `Parent` - """ - model = Parent() # noqa: E501 - if include_optional: - return Parent( - optional_dict = { - 'key' : petstore_api.models.inner_dict_with_property.InnerDictWithProperty( - a_property = petstore_api.models.a_property.aProperty(), ) - } - ) - else: - return Parent( - ) - """ - - def testParent(self): - """Test Parent""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_parent_with_optional_dict.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_parent_with_optional_dict.py deleted file mode 100644 index 2c668a7047a8..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_parent_with_optional_dict.py +++ /dev/null @@ -1,55 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.parent_with_optional_dict import ParentWithOptionalDict # noqa: E501 - -class TestParentWithOptionalDict(unittest.TestCase): - """ParentWithOptionalDict unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> ParentWithOptionalDict: - """Test ParentWithOptionalDict - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `ParentWithOptionalDict` - """ - model = ParentWithOptionalDict() # noqa: E501 - if include_optional: - return ParentWithOptionalDict( - optional_dict = { - 'key' : petstore_api.models.inner_dict_with_property.InnerDictWithProperty( - a_property = petstore_api.models.a_property.aProperty(), ) - } - ) - else: - return ParentWithOptionalDict( - ) - """ - - def testParentWithOptionalDict(self): - """Test ParentWithOptionalDict""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_pet.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_pet.py deleted file mode 100644 index f89e6cdf4b40..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_pet.py +++ /dev/null @@ -1,69 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.pet import Pet # noqa: E501 - -class TestPet(unittest.TestCase): - """Pet unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> Pet: - """Test Pet - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `Pet` - """ - model = Pet() # noqa: E501 - if include_optional: - return Pet( - id = 56, - category = petstore_api.models.category.Category( - id = 56, - name = 'default-name', ), - name = 'doggie', - photo_urls = [ - '' - ], - tags = [ - petstore_api.models.tag.Tag( - id = 56, - name = '', ) - ], - status = 'available' - ) - else: - return Pet( - name = 'doggie', - photo_urls = [ - '' - ], - ) - """ - - def testPet(self): - """Test Pet""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_pet_api.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_pet_api.py deleted file mode 100644 index 2352eb7ab403..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_pet_api.py +++ /dev/null @@ -1,94 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest - -from petstore_api.api.pet_api import PetApi # noqa: E501 - - -class TestPetApi(unittest.TestCase): - """PetApi unit test stubs""" - - def setUp(self) -> None: - self.api = PetApi() # noqa: E501 - - def tearDown(self) -> None: - pass - - def test_add_pet(self) -> None: - """Test case for add_pet - - Add a new pet to the store # noqa: E501 - """ - pass - - def test_delete_pet(self) -> None: - """Test case for delete_pet - - Deletes a pet # noqa: E501 - """ - pass - - def test_find_pets_by_status(self) -> None: - """Test case for find_pets_by_status - - Finds Pets by status # noqa: E501 - """ - pass - - def test_find_pets_by_tags(self) -> None: - """Test case for find_pets_by_tags - - Finds Pets by tags # noqa: E501 - """ - pass - - def test_get_pet_by_id(self) -> None: - """Test case for get_pet_by_id - - Find pet by ID # noqa: E501 - """ - pass - - def test_update_pet(self) -> None: - """Test case for update_pet - - Update an existing pet # noqa: E501 - """ - pass - - def test_update_pet_with_form(self) -> None: - """Test case for update_pet_with_form - - Updates a pet in the store with form data # noqa: E501 - """ - pass - - def test_upload_file(self) -> None: - """Test case for upload_file - - uploads an image # noqa: E501 - """ - pass - - def test_upload_file_with_required_file(self) -> None: - """Test case for upload_file_with_required_file - - uploads an image (required) # noqa: E501 - """ - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_pig.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_pig.py deleted file mode 100644 index cd3f112aabc5..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_pig.py +++ /dev/null @@ -1,57 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.pig import Pig # noqa: E501 - -class TestPig(unittest.TestCase): - """Pig unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> Pig: - """Test Pig - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `Pig` - """ - model = Pig() # noqa: E501 - if include_optional: - return Pig( - class_name = '', - color = '', - size = 56 - ) - else: - return Pig( - class_name = '', - color = '', - size = 56, - ) - """ - - def testPig(self): - """Test Pig""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_property_name_collision.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_property_name_collision.py deleted file mode 100644 index f9c8d8a77213..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_property_name_collision.py +++ /dev/null @@ -1,54 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.property_name_collision import PropertyNameCollision # noqa: E501 - -class TestPropertyNameCollision(unittest.TestCase): - """PropertyNameCollision unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> PropertyNameCollision: - """Test PropertyNameCollision - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `PropertyNameCollision` - """ - model = PropertyNameCollision() # noqa: E501 - if include_optional: - return PropertyNameCollision( - type = '', - type = '', - type_ = '' - ) - else: - return PropertyNameCollision( - ) - """ - - def testPropertyNameCollision(self): - """Test PropertyNameCollision""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_read_only_first.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_read_only_first.py deleted file mode 100644 index 1026a73205d4..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_read_only_first.py +++ /dev/null @@ -1,53 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.read_only_first import ReadOnlyFirst # noqa: E501 - -class TestReadOnlyFirst(unittest.TestCase): - """ReadOnlyFirst unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> ReadOnlyFirst: - """Test ReadOnlyFirst - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `ReadOnlyFirst` - """ - model = ReadOnlyFirst() # noqa: E501 - if include_optional: - return ReadOnlyFirst( - bar = '', - baz = '' - ) - else: - return ReadOnlyFirst( - ) - """ - - def testReadOnlyFirst(self): - """Test ReadOnlyFirst""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_second_ref.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_second_ref.py deleted file mode 100644 index 44194f94544f..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_second_ref.py +++ /dev/null @@ -1,58 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.second_ref import SecondRef # noqa: E501 - -class TestSecondRef(unittest.TestCase): - """SecondRef unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> SecondRef: - """Test SecondRef - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `SecondRef` - """ - model = SecondRef() # noqa: E501 - if include_optional: - return SecondRef( - category = '', - circular_ref = petstore_api.models.circular_reference_model.Circular-Reference-Model( - size = 56, - nested = petstore_api.models.first_ref.FirstRef( - category = '', - self_ref = petstore_api.models.second_ref.SecondRef( - category = '', ), ), ) - ) - else: - return SecondRef( - ) - """ - - def testSecondRef(self): - """Test SecondRef""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_self_reference_model.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_self_reference_model.py deleted file mode 100644 index 8c23008b26ed..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_self_reference_model.py +++ /dev/null @@ -1,58 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.self_reference_model import SelfReferenceModel # noqa: E501 - -class TestSelfReferenceModel(unittest.TestCase): - """SelfReferenceModel unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> SelfReferenceModel: - """Test SelfReferenceModel - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `SelfReferenceModel` - """ - model = SelfReferenceModel() # noqa: E501 - if include_optional: - return SelfReferenceModel( - size = 56, - nested = petstore_api.models.dummy_model.Dummy-Model( - category = '', - self_ref = petstore_api.models.self_reference_model.Self-Reference-Model( - size = 56, - nested = petstore_api.models.dummy_model.Dummy-Model( - category = '', ), ), ) - ) - else: - return SelfReferenceModel( - ) - """ - - def testSelfReferenceModel(self): - """Test SelfReferenceModel""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_single_ref_type.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_single_ref_type.py deleted file mode 100644 index f5642b8376b0..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_single_ref_type.py +++ /dev/null @@ -1,34 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.single_ref_type import SingleRefType # noqa: E501 - -class TestSingleRefType(unittest.TestCase): - """SingleRefType unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testSingleRefType(self): - """Test SingleRefType""" - # inst = SingleRefType() - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_special_character_enum.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_special_character_enum.py deleted file mode 100644 index ee5baab13095..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_special_character_enum.py +++ /dev/null @@ -1,34 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.special_character_enum import SpecialCharacterEnum # noqa: E501 - -class TestSpecialCharacterEnum(unittest.TestCase): - """SpecialCharacterEnum unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testSpecialCharacterEnum(self): - """Test SpecialCharacterEnum""" - # inst = SpecialCharacterEnum() - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_special_model_name.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_special_model_name.py deleted file mode 100644 index 12ec90a9067f..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_special_model_name.py +++ /dev/null @@ -1,52 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.special_model_name import SpecialModelName # noqa: E501 - -class TestSpecialModelName(unittest.TestCase): - """SpecialModelName unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> SpecialModelName: - """Test SpecialModelName - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `SpecialModelName` - """ - model = SpecialModelName() # noqa: E501 - if include_optional: - return SpecialModelName( - special_property_name = 56 - ) - else: - return SpecialModelName( - ) - """ - - def testSpecialModelName(self): - """Test SpecialModelName""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_special_name.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_special_name.py deleted file mode 100644 index afaf0996b74c..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_special_name.py +++ /dev/null @@ -1,56 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.special_name import SpecialName # noqa: E501 - -class TestSpecialName(unittest.TestCase): - """SpecialName unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> SpecialName: - """Test SpecialName - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `SpecialName` - """ - model = SpecialName() # noqa: E501 - if include_optional: - return SpecialName( - var_property = 56, - var_async = petstore_api.models.category.Category( - id = 56, - name = 'default-name', ), - var_schema = 'available' - ) - else: - return SpecialName( - ) - """ - - def testSpecialName(self): - """Test SpecialName""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_store_api.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_store_api.py deleted file mode 100644 index c25309ee006c..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_store_api.py +++ /dev/null @@ -1,59 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest - -from petstore_api.api.store_api import StoreApi # noqa: E501 - - -class TestStoreApi(unittest.TestCase): - """StoreApi unit test stubs""" - - def setUp(self) -> None: - self.api = StoreApi() # noqa: E501 - - def tearDown(self) -> None: - pass - - def test_delete_order(self) -> None: - """Test case for delete_order - - Delete purchase order by ID # noqa: E501 - """ - pass - - def test_get_inventory(self) -> None: - """Test case for get_inventory - - Returns pet inventories by status # noqa: E501 - """ - pass - - def test_get_order_by_id(self) -> None: - """Test case for get_order_by_id - - Find purchase order by ID # noqa: E501 - """ - pass - - def test_place_order(self) -> None: - """Test case for place_order - - Place an order for a pet # noqa: E501 - """ - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_tag.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_tag.py deleted file mode 100644 index d5ce3fb8a0cf..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_tag.py +++ /dev/null @@ -1,53 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.tag import Tag # noqa: E501 - -class TestTag(unittest.TestCase): - """Tag unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> Tag: - """Test Tag - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `Tag` - """ - model = Tag() # noqa: E501 - if include_optional: - return Tag( - id = 56, - name = '' - ) - else: - return Tag( - ) - """ - - def testTag(self): - """Test Tag""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_test_inline_freeform_additional_properties_request.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_test_inline_freeform_additional_properties_request.py deleted file mode 100644 index 5c40397bc913..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_test_inline_freeform_additional_properties_request.py +++ /dev/null @@ -1,52 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest # noqa: E501 - -class TestTestInlineFreeformAdditionalPropertiesRequest(unittest.TestCase): - """TestInlineFreeformAdditionalPropertiesRequest unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> TestInlineFreeformAdditionalPropertiesRequest: - """Test TestInlineFreeformAdditionalPropertiesRequest - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `TestInlineFreeformAdditionalPropertiesRequest` - """ - model = TestInlineFreeformAdditionalPropertiesRequest() # noqa: E501 - if include_optional: - return TestInlineFreeformAdditionalPropertiesRequest( - some_property = '' - ) - else: - return TestInlineFreeformAdditionalPropertiesRequest( - ) - """ - - def testTestInlineFreeformAdditionalPropertiesRequest(self): - """Test TestInlineFreeformAdditionalPropertiesRequest""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_tiger.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_tiger.py deleted file mode 100644 index 7aab61a46066..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_tiger.py +++ /dev/null @@ -1,52 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.tiger import Tiger # noqa: E501 - -class TestTiger(unittest.TestCase): - """Tiger unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> Tiger: - """Test Tiger - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `Tiger` - """ - model = Tiger() # noqa: E501 - if include_optional: - return Tiger( - skill = '' - ) - else: - return Tiger( - ) - """ - - def testTiger(self): - """Test Tiger""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_user.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_user.py deleted file mode 100644 index a1ce46e87a19..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_user.py +++ /dev/null @@ -1,59 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.user import User # noqa: E501 - -class TestUser(unittest.TestCase): - """User unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> User: - """Test User - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `User` - """ - model = User() # noqa: E501 - if include_optional: - return User( - id = 56, - username = '', - first_name = '', - last_name = '', - email = '', - password = '', - phone = '', - user_status = 56 - ) - else: - return User( - ) - """ - - def testUser(self): - """Test User""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_user_api.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_user_api.py deleted file mode 100644 index 28103bb27ea2..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_user_api.py +++ /dev/null @@ -1,87 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest - -from petstore_api.api.user_api import UserApi # noqa: E501 - - -class TestUserApi(unittest.TestCase): - """UserApi unit test stubs""" - - def setUp(self) -> None: - self.api = UserApi() # noqa: E501 - - def tearDown(self) -> None: - pass - - def test_create_user(self) -> None: - """Test case for create_user - - Create user # noqa: E501 - """ - pass - - def test_create_users_with_array_input(self) -> None: - """Test case for create_users_with_array_input - - Creates list of users with given input array # noqa: E501 - """ - pass - - def test_create_users_with_list_input(self) -> None: - """Test case for create_users_with_list_input - - Creates list of users with given input array # noqa: E501 - """ - pass - - def test_delete_user(self) -> None: - """Test case for delete_user - - Delete user # noqa: E501 - """ - pass - - def test_get_user_by_name(self) -> None: - """Test case for get_user_by_name - - Get user by user name # noqa: E501 - """ - pass - - def test_login_user(self) -> None: - """Test case for login_user - - Logs user into the system # noqa: E501 - """ - pass - - def test_logout_user(self) -> None: - """Test case for logout_user - - Logs out current logged in user session # noqa: E501 - """ - pass - - def test_update_user(self) -> None: - """Test case for update_user - - Updated user # noqa: E501 - """ - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_with_nested_one_of.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_with_nested_one_of.py deleted file mode 100644 index 43c4a69a29bb..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_with_nested_one_of.py +++ /dev/null @@ -1,54 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from petstore_api.models.with_nested_one_of import WithNestedOneOf # noqa: E501 - -class TestWithNestedOneOf(unittest.TestCase): - """WithNestedOneOf unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> WithNestedOneOf: - """Test WithNestedOneOf - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `WithNestedOneOf` - """ - model = WithNestedOneOf() # noqa: E501 - if include_optional: - return WithNestedOneOf( - size = 56, - nested_pig = None, - nested_oneof_enum_string = None - ) - else: - return WithNestedOneOf( - ) - """ - - def testWithNestedOneOf(self): - """Test WithNestedOneOf""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/tox.ini b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/tox.ini deleted file mode 100644 index 8989fc3c4d96..000000000000 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/tox.ini +++ /dev/null @@ -1,9 +0,0 @@ -[tox] -envlist = py3 - -[testenv] -deps=-r{toxinidir}/requirements.txt - -r{toxinidir}/test-requirements.txt - -commands= - pytest --cov=petstore_api diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/README.md b/samples/openapi3/client/petstore/python-pydantic-v1/README.md index c38079fcb5f8..66eeea58be79 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/README.md +++ b/samples/openapi3/client/petstore/python-pydantic-v1/README.md @@ -5,7 +5,7 @@ This Python package is automatically generated by the [OpenAPI Generator](https: - API version: 1.0.0 - Package version: 1.0.0 -- Build package: org.openapitools.codegen.languages.PythonClientPydanticV1Codegen +- Build package: org.openapitools.codegen.languages.PythonPydanticV1ClientCodegen ## Requirements. From 3571e8ff71c753bd99df599fa8d0a783786ac534 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Mon, 25 Sep 2023 13:15:56 +0800 Subject: [PATCH 3/7] copy tests --- pom.xml | 1 + .../petstore/python-pydantic-v1/Makefile | 21 + .../petstore/python-pydantic-v1/README.md | 2 +- .../python-pydantic-v1/dev-requirements.txt | 2 + .../api/fake_classname_tags_123_api.py | 181 ++++++ .../petstore/python-pydantic-v1/pom.xml | 46 ++ .../test_additional_properties_any_type.py | 14 +- .../test/test_additional_properties_class.py | 16 +- .../test/test_additional_properties_object.py | 14 +- ...tional_properties_with_description_only.py | 14 +- .../test/test_all_of_with_single_ref.py | 29 +- .../python-pydantic-v1/test/test_animal.py | 27 +- .../test/test_another_fake_api.py | 18 +- .../test/test_any_of_color.py | 18 +- .../test/test_any_of_pig.py | 32 +- .../test/test_api_response.py | 29 +- .../test/test_array_of_array_of_model.py | 16 +- .../test_array_of_array_of_number_only.py | 25 +- .../test/test_array_of_number_only.py | 25 +- .../test/test_array_test.py | 29 +- .../test/test_basque_pig.py | 27 +- .../test/test_capitalization.py | 35 +- .../python-pydantic-v1/test/test_cat.py | 27 +- .../python-pydantic-v1/test/test_category.py | 23 +- .../test/test_circular_reference_model.py | 18 +- .../test/test_class_model.py | 27 +- .../python-pydantic-v1/test/test_client.py | 25 +- .../python-pydantic-v1/test/test_color.py | 18 +- .../test/test_configuration.py | 54 ++ .../python-pydantic-v1/test/test_creature.py | 16 +- .../test/test_creature_info.py | 14 +- .../test/test_danish_pig.py | 27 +- .../test/test_default_api.py | 18 +- .../test/test_deprecated_object.py | 25 +- .../python-pydantic-v1/test/test_dog.py | 27 +- .../test/test_dummy_model.py | 20 +- .../test/test_enum_arrays.py | 23 +- .../test/test_enum_class.py | 10 +- .../test/test_enum_string1.py | 6 +- .../test/test_enum_string2.py | 6 +- .../python-pydantic-v1/test/test_enum_test.py | 38 +- .../python-pydantic-v1/test/test_fake_api.py | 115 ++-- .../test/test_fake_classname_tags123_api.py | 20 +- .../test/test_fake_classname_tags_123_api.py | 40 ++ .../python-pydantic-v1/test/test_file.py | 25 +- .../test/test_file_schema_test_class.py | 27 +- .../python-pydantic-v1/test/test_first_ref.py | 18 +- .../python-pydantic-v1/test/test_foo.py | 25 +- .../test/test_foo_get_default_response.py | 25 +- .../test/test_format_test.py | 62 +- .../test/test_has_only_read_only.py | 27 +- .../test/test_health_check_result.py | 25 +- .../test/test_inner_dict_with_property.py | 16 +- .../test/test_int_or_string.py | 14 +- .../python-pydantic-v1/test/test_list.py | 27 +- .../test/test_map_of_array_of_model.py | 14 +- .../python-pydantic-v1/test/test_map_test.py | 32 +- ...perties_and_additional_properties_class.py | 29 +- .../test/test_model200_response.py | 29 +- .../test/test_model_return.py | 27 +- .../python-pydantic-v1/test/test_name.py | 33 +- .../test/test_nullable_class.py | 50 +- .../test/test_nullable_property.py | 16 +- .../test/test_number_only.py | 25 +- ...st_object_to_test_additional_properties.py | 14 +- .../test_object_with_deprecated_fields.py | 31 +- .../test/test_one_of_enum_string.py | 14 +- .../python-pydantic-v1/test/test_order.py | 35 +- .../test/test_outer_composite.py | 29 +- .../test/test_outer_enum.py | 12 +- .../test/test_outer_enum_default_value.py | 10 +- .../test/test_outer_enum_integer.py | 10 +- .../test_outer_enum_integer_default_value.py | 26 +- .../test_outer_object_with_enum_property.py | 22 +- .../python-pydantic-v1/test/test_parent.py | 14 +- .../test/test_parent_with_optional_dict.py | 16 +- .../python-pydantic-v1/test/test_pet.py | 35 +- .../python-pydantic-v1/test/test_pet_api.py | 34 +- .../python-pydantic-v1/test/test_pig.py | 32 +- .../test/test_property_name_collision.py | 20 +- .../test/test_read_only_first.py | 27 +- .../test/test_second_ref.py | 18 +- .../test/test_self_reference_model.py | 20 +- .../test/test_single_ref_type.py | 26 +- .../test/test_special_character_enum.py | 10 +- .../test/test_special_model_name.py | 25 +- .../test/test_special_name.py | 24 +- .../python-pydantic-v1/test/test_store_api.py | 24 +- .../python-pydantic-v1/test/test_tag.py | 27 +- .../python-pydantic-v1/test/test_tiger.py | 14 +- .../python-pydantic-v1/test/test_user.py | 39 +- .../python-pydantic-v1/test/test_user_api.py | 32 +- .../test/test_with_nested_one_of.py | 30 +- .../python-pydantic-v1/test_python3.sh | 31 + .../python-pydantic-v1/testfiles/pix.gif | Bin 0 -> 42 bytes .../python-pydantic-v1/tests/__init__.py | 0 .../tests/test_api_client.py | 261 +++++++++ .../tests/test_api_exception.py | 82 +++ .../tests/test_api_validation.py | 79 +++ .../tests/test_configuration.py | 62 ++ .../tests/test_deserialization.py | 295 ++++++++++ .../tests/test_http_signature.py | 521 +++++++++++++++++ .../python-pydantic-v1/tests/test_map_test.py | 117 ++++ .../python-pydantic-v1/tests/test_model.py | 536 ++++++++++++++++++ .../tests/test_order_model.py | 20 + .../python-pydantic-v1/tests/test_pet_api.py | 269 +++++++++ .../tests/test_pet_model.py | 115 ++++ .../tests/test_store_api.py | 32 ++ .../petstore/python-pydantic-v1/tests/util.py | 8 + .../openapi3/client/petstore/python/pom.xml | 2 +- 110 files changed, 3808 insertions(+), 1056 deletions(-) create mode 100755 samples/openapi3/client/petstore/python-pydantic-v1/Makefile create mode 100755 samples/openapi3/client/petstore/python-pydantic-v1/dev-requirements.txt create mode 100755 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/api/fake_classname_tags_123_api.py create mode 100755 samples/openapi3/client/petstore/python-pydantic-v1/pom.xml create mode 100755 samples/openapi3/client/petstore/python-pydantic-v1/test/test_configuration.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_fake_classname_tags_123_api.py create mode 100755 samples/openapi3/client/petstore/python-pydantic-v1/test_python3.sh create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/testfiles/pix.gif create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/tests/__init__.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/tests/test_api_client.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/tests/test_api_exception.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/tests/test_api_validation.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/tests/test_configuration.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/tests/test_deserialization.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/tests/test_http_signature.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/tests/test_map_test.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/tests/test_model.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/tests/test_order_model.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/tests/test_pet_api.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/tests/test_pet_model.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/tests/test_store_api.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/tests/util.py diff --git a/pom.xml b/pom.xml index 174fdcc71489..31051404b8ef 100644 --- a/pom.xml +++ b/pom.xml @@ -1217,6 +1217,7 @@ samples/openapi3/client/petstore/python + samples/openapi3/client/petstore/python-pydantic-v1 samples/openapi3/client/petstore/python-aiohttp diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/Makefile b/samples/openapi3/client/petstore/python-pydantic-v1/Makefile new file mode 100755 index 000000000000..739b58747458 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/Makefile @@ -0,0 +1,21 @@ + #!/bin/bash + +REQUIREMENTS_FILE=dev-requirements.txt +REQUIREMENTS_OUT=dev-requirements.txt.log +SETUP_OUT=*.egg-info +VENV=.venv + +clean: + rm -rf $(REQUIREMENTS_OUT) + rm -rf $(SETUP_OUT) + rm -rf $(VENV) + rm -rf .tox + rm -rf .coverage + find . -name "*.py[oc]" -delete + find . -name "__pycache__" -delete + +test: clean + bash ./test_python3.sh + +test-all: clean + bash ./test_python3.sh diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/README.md b/samples/openapi3/client/petstore/python-pydantic-v1/README.md index 66eeea58be79..e4cc8831876b 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/README.md +++ b/samples/openapi3/client/petstore/python-pydantic-v1/README.md @@ -5,7 +5,7 @@ This Python package is automatically generated by the [OpenAPI Generator](https: - API version: 1.0.0 - Package version: 1.0.0 -- Build package: org.openapitools.codegen.languages.PythonPydanticV1ClientCodegen +- Build package: org.openapitools.codegen.languages.PythonClientCodegen ## Requirements. diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/dev-requirements.txt b/samples/openapi3/client/petstore/python-pydantic-v1/dev-requirements.txt new file mode 100755 index 000000000000..ccdfca629494 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/dev-requirements.txt @@ -0,0 +1,2 @@ +tox +flake8 diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/api/fake_classname_tags_123_api.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/api/fake_classname_tags_123_api.py new file mode 100755 index 000000000000..05c1c8a0e4ff --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/api/fake_classname_tags_123_api.py @@ -0,0 +1,181 @@ +# 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 re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from petstore_api.api_client import ApiClient +from petstore_api.exceptions import ( # noqa: F401 + ApiTypeError, + ApiValueError +) + + +class FakeClassnameTags123Api(object): + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def test_classname(self, client, **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(client, async_req=True) + >>> result = thread.get() + + :param client: client model (required) + :type client: Client + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :type _preload_content: bool, optional + :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: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: Client + """ + kwargs['_return_http_data_only'] = True + return self.test_classname_with_http_info(client, **kwargs) # noqa: E501 + + def test_classname_with_http_info(self, client, **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(client, async_req=True) + >>> result = thread.get() + + :param client: client model (required) + :type client: Client + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _return_http_data_only: response data without head status code + and headers + :type _return_http_data_only: bool, optional + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :type _preload_content: bool, optional + :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. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(Client, status_code(int), headers(HTTPHeaderDict)) + """ + + local_var_params = locals() + + all_params = [ + 'client' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + 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 + ) + local_var_params[key] = val + del local_var_params['kwargs'] + # verify the required parameter 'client' is set + if self.api_client.client_side_validation and ('client' not in local_var_params or # noqa: E501 + local_var_params['client'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `client` when calling `test_classname`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = dict(local_var_params.get('_headers', {})) + + form_params = [] + local_var_files = {} + + body_params = None + if 'client' in local_var_params: + body_params = local_var_params['client'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = local_var_params.get('_content_type', + self.api_client.select_header_content_type( + ['application/json'], + 'PATCH', body_params)) # noqa: E501 + + # Authentication setting + auth_settings = ['api_key_query'] # noqa: E501 + + response_types_map = { + 200: "Client", + } + + 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_types_map=response_types_map, + 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, + _request_auth=local_var_params.get('_request_auth')) diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/pom.xml b/samples/openapi3/client/petstore/python-pydantic-v1/pom.xml new file mode 100755 index 000000000000..fbe7621223e7 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/pom.xml @@ -0,0 +1,46 @@ + + 4.0.0 + org.openapitools + PythonPydanticv1PetstoreTests + pom + 1.0-SNAPSHOT + Python OpenAPI3 Petstore Client + + + + maven-dependency-plugin + + + package + + copy-dependencies + + + ${project.build.directory} + + + + + + org.codehaus.mojo + exec-maven-plugin + 1.2.1 + + + test + integration-test + + exec + + + make + + test-all + + + + + + + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_additional_properties_any_type.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_additional_properties_any_type.py index a1669f0664d2..c2c9c7c58069 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_additional_properties_any_type.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_additional_properties_any_type.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 +""" import unittest import datetime +import petstore_api from petstore_api.models.additional_properties_any_type import AdditionalPropertiesAnyType # noqa: E501 +from petstore_api.rest import ApiException class TestAdditionalPropertiesAnyType(unittest.TestCase): """AdditionalPropertiesAnyType unit test stubs""" @@ -26,19 +28,19 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> AdditionalPropertiesAnyType: + def make_instance(self, include_optional): """Test AdditionalPropertiesAnyType include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `AdditionalPropertiesAnyType` """ - model = AdditionalPropertiesAnyType() # noqa: E501 - if include_optional: + model = petstore_api.models.additional_properties_any_type.AdditionalPropertiesAnyType() # noqa: E501 + if include_optional : return AdditionalPropertiesAnyType( name = '' ) - else: + else : return AdditionalPropertiesAnyType( ) """ diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_additional_properties_class.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_additional_properties_class.py index d1dc12c44584..e3b48bedd571 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_additional_properties_class.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_additional_properties_class.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 +""" import unittest import datetime +import petstore_api from petstore_api.models.additional_properties_class import AdditionalPropertiesClass # noqa: E501 +from petstore_api.rest import ApiException class TestAdditionalPropertiesClass(unittest.TestCase): """AdditionalPropertiesClass unit test stubs""" @@ -26,26 +28,26 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> AdditionalPropertiesClass: + def make_instance(self, include_optional): """Test AdditionalPropertiesClass include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `AdditionalPropertiesClass` """ - model = AdditionalPropertiesClass() # noqa: E501 - if include_optional: + model = petstore_api.models.additional_properties_class.AdditionalPropertiesClass() # noqa: E501 + if include_optional : return AdditionalPropertiesClass( map_property = { 'key' : '' - }, + }, map_of_map_property = { 'key' : { 'key' : '' } } ) - else: + else : return AdditionalPropertiesClass( ) """ diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_additional_properties_object.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_additional_properties_object.py index 9bfa2a0cde83..b68a8fda5790 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_additional_properties_object.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_additional_properties_object.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 +""" import unittest import datetime +import petstore_api from petstore_api.models.additional_properties_object import AdditionalPropertiesObject # noqa: E501 +from petstore_api.rest import ApiException class TestAdditionalPropertiesObject(unittest.TestCase): """AdditionalPropertiesObject unit test stubs""" @@ -26,19 +28,19 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> AdditionalPropertiesObject: + def make_instance(self, include_optional): """Test AdditionalPropertiesObject include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `AdditionalPropertiesObject` """ - model = AdditionalPropertiesObject() # noqa: E501 - if include_optional: + model = petstore_api.models.additional_properties_object.AdditionalPropertiesObject() # noqa: E501 + if include_optional : return AdditionalPropertiesObject( name = '' ) - else: + else : return AdditionalPropertiesObject( ) """ diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_additional_properties_with_description_only.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_additional_properties_with_description_only.py index 88df1cc92955..d5166dfe1342 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_additional_properties_with_description_only.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_additional_properties_with_description_only.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 +""" import unittest import datetime +import petstore_api from petstore_api.models.additional_properties_with_description_only import AdditionalPropertiesWithDescriptionOnly # noqa: E501 +from petstore_api.rest import ApiException class TestAdditionalPropertiesWithDescriptionOnly(unittest.TestCase): """AdditionalPropertiesWithDescriptionOnly unit test stubs""" @@ -26,19 +28,19 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> AdditionalPropertiesWithDescriptionOnly: + def make_instance(self, include_optional): """Test AdditionalPropertiesWithDescriptionOnly include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `AdditionalPropertiesWithDescriptionOnly` """ - model = AdditionalPropertiesWithDescriptionOnly() # noqa: E501 - if include_optional: + model = petstore_api.models.additional_properties_with_description_only.AdditionalPropertiesWithDescriptionOnly() # noqa: E501 + if include_optional : return AdditionalPropertiesWithDescriptionOnly( name = '' ) - else: + else : return AdditionalPropertiesWithDescriptionOnly( ) """ diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_all_of_with_single_ref.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_all_of_with_single_ref.py index 920ad3782e15..ee761ef82d0a 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_all_of_with_single_ref.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_all_of_with_single_ref.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.all_of_with_single_ref import AllOfWithSingleRef # noqa: E501 +from petstore_api.rest import ApiException class TestAllOfWithSingleRef(unittest.TestCase): """AllOfWithSingleRef unit test stubs""" @@ -26,28 +28,25 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> AllOfWithSingleRef: + def make_instance(self, include_optional): """Test AllOfWithSingleRef include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # uncomment below to create an instance of `AllOfWithSingleRef` - """ - model = AllOfWithSingleRef() # noqa: E501 - if include_optional: + # model = petstore_api.models.all_of_with_single_ref.AllOfWithSingleRef() # noqa: E501 + if include_optional : return AllOfWithSingleRef( - username = '', - single_ref_type = 'admin' + username = '', + single_ref_type = None ) - else: + else : return AllOfWithSingleRef( ) - """ def testAllOfWithSingleRef(self): """Test AllOfWithSingleRef""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_animal.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_animal.py index b0b62a0bb2b3..d209151de678 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_animal.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_animal.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.animal import Animal # noqa: E501 +from petstore_api.rest import ApiException class TestAnimal(unittest.TestCase): """Animal unit test stubs""" @@ -26,29 +28,26 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> Animal: + def make_instance(self, include_optional): """Test Animal include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # uncomment below to create an instance of `Animal` - """ - model = Animal() # noqa: E501 - if include_optional: + # model = petstore_api.models.animal.Animal() # noqa: E501 + if include_optional : return Animal( - class_name = '', + class_name = '', color = 'red' ) - else: + else : return Animal( class_name = '', ) - """ def testAnimal(self): """Test Animal""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_another_fake_api.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_another_fake_api.py index a6070f5b5f54..d95798cfc5a4 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_another_fake_api.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_another_fake_api.py @@ -3,30 +3,32 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest +import petstore_api from petstore_api.api.another_fake_api import AnotherFakeApi # noqa: E501 +from petstore_api.rest import ApiException class TestAnotherFakeApi(unittest.TestCase): """AnotherFakeApi unit test stubs""" - def setUp(self) -> None: - self.api = AnotherFakeApi() # noqa: E501 + def setUp(self): + self.api = petstore_api.api.another_fake_api.AnotherFakeApi() # noqa: E501 - def tearDown(self) -> None: + def tearDown(self): pass - def test_call_123_test_special_tags(self) -> None: + def test_call_123_test_special_tags(self): """Test case for call_123_test_special_tags To test special tags # noqa: E501 diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_any_of_color.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_any_of_color.py index f99dfd0020b1..2a97cfef7526 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_any_of_color.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_any_of_color.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.any_of_color import AnyOfColor # noqa: E501 +from petstore_api.rest import ApiException class TestAnyOfColor(unittest.TestCase): """AnyOfColor unit test stubs""" @@ -26,18 +28,18 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> AnyOfColor: + def make_instance(self, include_optional): """Test AnyOfColor include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `AnyOfColor` """ - model = AnyOfColor() # noqa: E501 - if include_optional: + model = petstore_api.models.any_of_color.AnyOfColor() # noqa: E501 + if include_optional : return AnyOfColor( ) - else: + else : return AnyOfColor( ) """ diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_any_of_pig.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_any_of_pig.py index c3e4760182c5..f041e5f9d6f7 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_any_of_pig.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_any_of_pig.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.any_of_pig import AnyOfPig # noqa: E501 +from petstore_api.rest import ApiException class TestAnyOfPig(unittest.TestCase): """AnyOfPig unit test stubs""" @@ -26,28 +28,6 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> AnyOfPig: - """Test AnyOfPig - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `AnyOfPig` - """ - model = AnyOfPig() # noqa: E501 - if include_optional: - return AnyOfPig( - class_name = '', - color = '', - size = 56 - ) - else: - return AnyOfPig( - class_name = '', - color = '', - size = 56, - ) - """ - def testAnyOfPig(self): """Test AnyOfPig""" # inst_req_only = self.make_instance(include_optional=False) diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_api_response.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_api_response.py index 9882aa1b9005..95efd33bce57 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_api_response.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_api_response.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.api_response import ApiResponse # noqa: E501 +from petstore_api.rest import ApiException class TestApiResponse(unittest.TestCase): """ApiResponse unit test stubs""" @@ -26,29 +28,26 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> ApiResponse: + def make_instance(self, include_optional): """Test ApiResponse include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # uncomment below to create an instance of `ApiResponse` - """ - model = ApiResponse() # noqa: E501 - if include_optional: + # model = petstore_api.models.api_response.ApiResponse() # noqa: E501 + if include_optional : return ApiResponse( - code = 56, - type = '', + code = 56, + type = '', message = '' ) - else: + else : return ApiResponse( ) - """ def testApiResponse(self): """Test ApiResponse""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_array_of_array_of_model.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_array_of_array_of_model.py index 7c0809b0b233..1072a19255de 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_array_of_array_of_model.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_array_of_array_of_model.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 +""" import unittest import datetime +import petstore_api from petstore_api.models.array_of_array_of_model import ArrayOfArrayOfModel # noqa: E501 +from petstore_api.rest import ApiException class TestArrayOfArrayOfModel(unittest.TestCase): """ArrayOfArrayOfModel unit test stubs""" @@ -26,17 +28,17 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> ArrayOfArrayOfModel: + def make_instance(self, include_optional): """Test ArrayOfArrayOfModel include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `ArrayOfArrayOfModel` """ - model = ArrayOfArrayOfModel() # noqa: E501 - if include_optional: + model = petstore_api.models.array_of_array_of_model.ArrayOfArrayOfModel() # noqa: E501 + if include_optional : return ArrayOfArrayOfModel( - another_property = [ + shop_id_to_org_online_lip_map = [ [ petstore_api.models.tag.Tag( id = 56, @@ -44,7 +46,7 @@ def make_instance(self, include_optional) -> ArrayOfArrayOfModel: ] ] ) - else: + else : return ArrayOfArrayOfModel( ) """ diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_array_of_array_of_number_only.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_array_of_array_of_number_only.py index 22160c2bd055..001b4e565737 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_array_of_array_of_number_only.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_array_of_array_of_number_only.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.array_of_array_of_number_only import ArrayOfArrayOfNumberOnly # noqa: E501 +from petstore_api.rest import ApiException class TestArrayOfArrayOfNumberOnly(unittest.TestCase): """ArrayOfArrayOfNumberOnly unit test stubs""" @@ -26,15 +28,13 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> ArrayOfArrayOfNumberOnly: + def make_instance(self, include_optional): """Test ArrayOfArrayOfNumberOnly include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # uncomment below to create an instance of `ArrayOfArrayOfNumberOnly` - """ - model = ArrayOfArrayOfNumberOnly() # noqa: E501 - if include_optional: + # model = petstore_api.models.array_of_array_of_number_only.ArrayOfArrayOfNumberOnly() # noqa: E501 + if include_optional : return ArrayOfArrayOfNumberOnly( array_array_number = [ [ @@ -42,15 +42,14 @@ def make_instance(self, include_optional) -> ArrayOfArrayOfNumberOnly: ] ] ) - else: + else : return ArrayOfArrayOfNumberOnly( ) - """ def testArrayOfArrayOfNumberOnly(self): """Test ArrayOfArrayOfNumberOnly""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_array_of_number_only.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_array_of_number_only.py index ade32f4f8f21..a35703ae0dac 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_array_of_number_only.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_array_of_number_only.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.array_of_number_only import ArrayOfNumberOnly # noqa: E501 +from petstore_api.rest import ApiException class TestArrayOfNumberOnly(unittest.TestCase): """ArrayOfNumberOnly unit test stubs""" @@ -26,29 +28,26 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> ArrayOfNumberOnly: + def make_instance(self, include_optional): """Test ArrayOfNumberOnly include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # uncomment below to create an instance of `ArrayOfNumberOnly` - """ - model = ArrayOfNumberOnly() # noqa: E501 - if include_optional: + # model = petstore_api.models.array_of_number_only.ArrayOfNumberOnly() # noqa: E501 + if include_optional : return ArrayOfNumberOnly( array_number = [ 1.337 ] ) - else: + else : return ArrayOfNumberOnly( ) - """ def testArrayOfNumberOnly(self): """Test ArrayOfNumberOnly""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_array_test.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_array_test.py index dc20a60413cd..8327e415adcd 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_array_test.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_array_test.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.array_test import ArrayTest # noqa: E501 +from petstore_api.rest import ApiException class TestArrayTest(unittest.TestCase): """ArrayTest unit test stubs""" @@ -26,24 +28,22 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> ArrayTest: + def make_instance(self, include_optional): """Test ArrayTest include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # uncomment below to create an instance of `ArrayTest` - """ - model = ArrayTest() # noqa: E501 - if include_optional: + # model = petstore_api.models.array_test.ArrayTest() # noqa: E501 + if include_optional : return ArrayTest( array_of_string = [ '' - ], + ], array_array_of_integer = [ [ 56 ] - ], + ], array_array_of_model = [ [ petstore_api.models.read_only_first.ReadOnlyFirst( @@ -52,15 +52,14 @@ def make_instance(self, include_optional) -> ArrayTest: ] ] ) - else: + else : return ArrayTest( ) - """ def testArrayTest(self): """Test ArrayTest""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_basque_pig.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_basque_pig.py index 42f62fa31115..26e2a845a95c 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_basque_pig.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_basque_pig.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.basque_pig import BasquePig # noqa: E501 +from petstore_api.rest import ApiException class TestBasquePig(unittest.TestCase): """BasquePig unit test stubs""" @@ -26,30 +28,27 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> BasquePig: + def make_instance(self, include_optional): """Test BasquePig include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # uncomment below to create an instance of `BasquePig` - """ - model = BasquePig() # noqa: E501 - if include_optional: + # model = petstore_api.models.basque_pig.BasquePig() # noqa: E501 + if include_optional : return BasquePig( - class_name = '', + class_name = '', color = '' ) - else: + else : return BasquePig( class_name = '', color = '', ) - """ def testBasquePig(self): """Test BasquePig""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) + #inst_req_only = self.make_instance(include_optional=False) + #inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_capitalization.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_capitalization.py index 17b75e51e363..c7a9721dbc00 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_capitalization.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_capitalization.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.capitalization import Capitalization # noqa: E501 +from petstore_api.rest import ApiException class TestCapitalization(unittest.TestCase): """Capitalization unit test stubs""" @@ -26,32 +28,29 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> Capitalization: + def make_instance(self, include_optional): """Test Capitalization include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # uncomment below to create an instance of `Capitalization` - """ - model = Capitalization() # noqa: E501 - if include_optional: + # model = petstore_api.models.capitalization.Capitalization() # noqa: E501 + if include_optional : return Capitalization( - small_camel = '', - capital_camel = '', - small_snake = '', - capital_snake = '', - sca_eth_flow_points = '', + small_camel = '', + capital_camel = '', + small_snake = '', + capital_snake = '', + sca_eth_flow_points = '', att_name = '' ) - else: + else : return Capitalization( ) - """ def testCapitalization(self): """Test Capitalization""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_cat.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_cat.py index 58e743f44c86..e04566b1aafd 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_cat.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_cat.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.cat import Cat # noqa: E501 +from petstore_api.rest import ApiException class TestCat(unittest.TestCase): """Cat unit test stubs""" @@ -26,23 +28,6 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> Cat: - """Test Cat - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `Cat` - """ - model = Cat() # noqa: E501 - if include_optional: - return Cat( - declawed = True - ) - else: - return Cat( - ) - """ - def testCat(self): """Test Cat""" # inst_req_only = self.make_instance(include_optional=False) diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_category.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_category.py index 2a287246f81a..14848fcebcd2 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_category.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_category.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.category import Category # noqa: E501 +from petstore_api.rest import ApiException class TestCategory(unittest.TestCase): """Category unit test stubs""" @@ -26,24 +28,21 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> Category: + def make_instance(self, include_optional): """Test Category include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # uncomment below to create an instance of `Category` - """ - model = Category() # noqa: E501 - if include_optional: + # model = petstore_api.models.category.Category() # noqa: E501 + if include_optional : return Category( - id = 56, + id = 56, name = 'default-name' ) - else: + else : return Category( name = 'default-name', ) - """ def testCategory(self): """Test Category""" diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_circular_reference_model.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_circular_reference_model.py index f23f02000225..f734d3fc0ff6 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_circular_reference_model.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_circular_reference_model.py @@ -3,19 +3,23 @@ """ OpenAPI Petstore - This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 +""" + +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.circular_reference_model import CircularReferenceModel # noqa: E501 +from petstore_api.rest import ApiException class TestCircularReferenceModel(unittest.TestCase): """CircularReferenceModel unit test stubs""" @@ -26,17 +30,17 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> CircularReferenceModel: + def make_instance(self, include_optional): """Test CircularReferenceModel include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `CircularReferenceModel` """ - model = CircularReferenceModel() # noqa: E501 - if include_optional: + model = petstore_api.models.circular_reference_model.CircularReferenceModel() # noqa: E501 + if include_optional : return CircularReferenceModel( - size = 56, + size = 56, nested = petstore_api.models.first_ref.FirstRef( category = '', self_ref = petstore_api.models.second_ref.SecondRef( @@ -46,7 +50,7 @@ def make_instance(self, include_optional) -> CircularReferenceModel: nested = petstore_api.models.first_ref.FirstRef( category = '', ), ), ), ) ) - else: + else : return CircularReferenceModel( ) """ diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_class_model.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_class_model.py index 6b78a1941820..511843f2dcfd 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_class_model.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_class_model.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.class_model import ClassModel # noqa: E501 +from petstore_api.rest import ApiException class TestClassModel(unittest.TestCase): """ClassModel unit test stubs""" @@ -26,27 +28,24 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> ClassModel: + def make_instance(self, include_optional): """Test ClassModel include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # uncomment below to create an instance of `ClassModel` - """ - model = ClassModel() # noqa: E501 - if include_optional: + # model = petstore_api.models.class_model.ClassModel() # noqa: E501 + if include_optional : return ClassModel( - var_class = '' + _class = '' ) - else: + else : return ClassModel( ) - """ def testClassModel(self): """Test ClassModel""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_client.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_client.py index 9d109601e811..9209bb2c3f03 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_client.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_client.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.client import Client # noqa: E501 +from petstore_api.rest import ApiException class TestClient(unittest.TestCase): """Client unit test stubs""" @@ -26,27 +28,24 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> Client: + def make_instance(self, include_optional): """Test Client include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # uncomment below to create an instance of `Client` - """ - model = Client() # noqa: E501 - if include_optional: + # model = petstore_api.models.client.Client() # noqa: E501 + if include_optional : return Client( client = '' ) - else: + else : return Client( ) - """ def testClient(self): """Test Client""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_color.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_color.py index 21f53552b360..9a7aabfea253 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_color.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_color.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.color import Color # noqa: E501 +from petstore_api.rest import ApiException class TestColor(unittest.TestCase): """Color unit test stubs""" @@ -26,18 +28,18 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> Color: + def make_instance(self, include_optional): """Test Color include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Color` """ - model = Color() # noqa: E501 - if include_optional: + model = petstore_api.models.color.Color() # noqa: E501 + if include_optional : return Color( ) - else: + else : return Color( ) """ diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_configuration.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_configuration.py new file mode 100755 index 000000000000..d41ffa63ba8a --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_configuration.py @@ -0,0 +1,54 @@ +# 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 + + OpenAPI spec version: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +from __future__ import absolute_import + +import unittest + +import petstore_api +from petstore_api import Configuration # noqa: E501 +from petstore_api.rest import ApiException + + +class TestConfiguration(unittest.TestCase): + """Configuration unit test stubs""" + + def setUp(self): + self.config= Configuration() + + def tearDown(self): + pass + + def test_configuration(self): + """Test configuration + + Test host settings # noqa: E501 + """ + host_settings = self.config.get_host_settings() + + self.assertEqual('http://{server}.swagger.io:{port}/v2', host_settings[0]['url']) + self.assertEqual('petstore', host_settings[0]['variables']['server']['default_value']) + + self.assertEqual('https://localhost:8080/{version}', host_settings[1]['url']) + self.assertEqual('v2', host_settings[1]['variables']['version']['default_value']) + + def test_get_host_from_settings(self): + """ Test get_host_from_settings + + Test get URL from host settings + """ + self.assertEqual("http://petstore.swagger.io:80/v2", self.config.get_host_from_settings(0)) + self.assertEqual("http://petstore.swagger.io:8080/v2", self.config.get_host_from_settings(0, {'port': '8080'})) + self.assertEqual("http://dev-petstore.swagger.io:8080/v2", self.config.get_host_from_settings(0, {'server': 'dev-petstore', 'port': '8080'})) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_creature.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_creature.py index af6b9ef7b311..66b3e088cbbf 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_creature.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_creature.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 +""" import unittest import datetime +import petstore_api from petstore_api.models.creature import Creature # noqa: E501 +from petstore_api.rest import ApiException class TestCreature(unittest.TestCase): """Creature unit test stubs""" @@ -26,21 +28,21 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> Creature: + def make_instance(self, include_optional): """Test Creature include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Creature` """ - model = Creature() # noqa: E501 - if include_optional: + model = petstore_api.models.creature.Creature() # noqa: E501 + if include_optional : return Creature( info = petstore_api.models.creature_info.CreatureInfo( - name = '', ), + name = '', ), type = '' ) - else: + else : return Creature( info = petstore_api.models.creature_info.CreatureInfo( name = '', ), diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_creature_info.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_creature_info.py index a95dfd3d922b..0a85d5ffe7b2 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_creature_info.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_creature_info.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 +""" import unittest import datetime +import petstore_api from petstore_api.models.creature_info import CreatureInfo # noqa: E501 +from petstore_api.rest import ApiException class TestCreatureInfo(unittest.TestCase): """CreatureInfo unit test stubs""" @@ -26,19 +28,19 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> CreatureInfo: + def make_instance(self, include_optional): """Test CreatureInfo include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `CreatureInfo` """ - model = CreatureInfo() # noqa: E501 - if include_optional: + model = petstore_api.models.creature_info.CreatureInfo() # noqa: E501 + if include_optional : return CreatureInfo( name = '' ) - else: + else : return CreatureInfo( name = '', ) diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_danish_pig.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_danish_pig.py index bbd0ffcb5f01..0d850ae94f41 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_danish_pig.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_danish_pig.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.danish_pig import DanishPig # noqa: E501 +from petstore_api.rest import ApiException class TestDanishPig(unittest.TestCase): """DanishPig unit test stubs""" @@ -26,30 +28,27 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> DanishPig: + def make_instance(self, include_optional): """Test DanishPig include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # uncomment below to create an instance of `DanishPig` - """ - model = DanishPig() # noqa: E501 - if include_optional: + # model = petstore_api.models.danish_pig.DanishPig() # noqa: E501 + if include_optional : return DanishPig( - class_name = '', + class_name = '', size = 56 ) - else: + else : return DanishPig( class_name = '', size = 56, ) - """ def testDanishPig(self): """Test DanishPig""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) + #inst_req_only = self.make_instance(include_optional=False) + #inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_default_api.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_default_api.py index 2d9b266a7258..50e7c57bd0bf 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_default_api.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_default_api.py @@ -3,30 +3,32 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest +import petstore_api from petstore_api.api.default_api import DefaultApi # noqa: E501 +from petstore_api.rest import ApiException class TestDefaultApi(unittest.TestCase): """DefaultApi unit test stubs""" - def setUp(self) -> None: - self.api = DefaultApi() # noqa: E501 + def setUp(self): + self.api = petstore_api.api.default_api.DefaultApi() # noqa: E501 - def tearDown(self) -> None: + def tearDown(self): pass - def test_foo_get(self) -> None: + def test_foo_get(self): """Test case for foo_get """ diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_deprecated_object.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_deprecated_object.py index ba3a63c719de..50257271cd72 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_deprecated_object.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_deprecated_object.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.deprecated_object import DeprecatedObject # noqa: E501 +from petstore_api.rest import ApiException class TestDeprecatedObject(unittest.TestCase): """DeprecatedObject unit test stubs""" @@ -26,27 +28,24 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> DeprecatedObject: + def make_instance(self, include_optional): """Test DeprecatedObject include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # uncomment below to create an instance of `DeprecatedObject` - """ - model = DeprecatedObject() # noqa: E501 - if include_optional: + # model = petstore_api.models.deprecated_object.DeprecatedObject() # noqa: E501 + if include_optional : return DeprecatedObject( name = '' ) - else: + else : return DeprecatedObject( ) - """ def testDeprecatedObject(self): """Test DeprecatedObject""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_dog.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_dog.py index d8a51df906c0..af75161287e1 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_dog.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_dog.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.dog import Dog # noqa: E501 +from petstore_api.rest import ApiException class TestDog(unittest.TestCase): """Dog unit test stubs""" @@ -26,23 +28,6 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> Dog: - """Test Dog - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `Dog` - """ - model = Dog() # noqa: E501 - if include_optional: - return Dog( - breed = '' - ) - else: - return Dog( - ) - """ - def testDog(self): """Test Dog""" # inst_req_only = self.make_instance(include_optional=False) diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_dummy_model.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_dummy_model.py index 45459b666b16..d6562c58bc2d 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_dummy_model.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_dummy_model.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.dummy_model import DummyModel # noqa: E501 +from petstore_api.rest import ApiException class TestDummyModel(unittest.TestCase): """DummyModel unit test stubs""" @@ -26,23 +28,23 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> DummyModel: + def make_instance(self, include_optional): """Test DummyModel include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `DummyModel` """ - model = DummyModel() # noqa: E501 - if include_optional: + model = petstore_api.models.dummy_model.DummyModel() # noqa: E501 + if include_optional : return DummyModel( - category = '', + category = '', self_ref = petstore_api.models.self_reference_model.Self-Reference-Model( size = 56, nested = petstore_api.models.dummy_model.Dummy-Model( category = '', ), ) ) - else: + else : return DummyModel( ) """ diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_arrays.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_arrays.py index 21e4cf531c4e..52cc98601bc0 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_arrays.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_arrays.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.enum_arrays import EnumArrays # noqa: E501 +from petstore_api.rest import ApiException class TestEnumArrays(unittest.TestCase): """EnumArrays unit test stubs""" @@ -26,25 +28,22 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> EnumArrays: + def make_instance(self, include_optional): """Test EnumArrays include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # uncomment below to create an instance of `EnumArrays` - """ - model = EnumArrays() # noqa: E501 - if include_optional: + # model = petstore_api.models.enum_arrays.EnumArrays() # noqa: E501 + if include_optional : return EnumArrays( - just_symbol = '>=', + just_symbol = '>=', array_enum = [ 'fish' ] ) - else: + else : return EnumArrays( ) - """ def testEnumArrays(self): """Test EnumArrays""" diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_class.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_class.py index 92822bcdd970..9d7a81272cd2 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_class.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_class.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.enum_class import EnumClass # noqa: E501 +from petstore_api.rest import ApiException class TestEnumClass(unittest.TestCase): """EnumClass unit test stubs""" diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_string1.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_string1.py index 9cbeacbe344d..9dbe9eb44fb8 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_string1.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_string1.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 +""" import unittest import datetime +import petstore_api from petstore_api.models.enum_string1 import EnumString1 # noqa: E501 +from petstore_api.rest import ApiException class TestEnumString1(unittest.TestCase): """EnumString1 unit test stubs""" diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_string2.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_string2.py index 409c7f257a58..4ec0ffcd86c7 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_string2.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_string2.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 +""" import unittest import datetime +import petstore_api from petstore_api.models.enum_string2 import EnumString2 # noqa: E501 +from petstore_api.rest import ApiException class TestEnumString2(unittest.TestCase): """EnumString2 unit test stubs""" diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_test.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_test.py index b706fa63df22..afb342ae9341 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_test.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_test.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.enum_test import EnumTest # noqa: E501 +from petstore_api.rest import ApiException class TestEnumTest(unittest.TestCase): """EnumTest unit test stubs""" @@ -26,31 +28,27 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> EnumTest: + def make_instance(self, include_optional): """Test EnumTest include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # uncomment below to create an instance of `EnumTest` - """ - model = EnumTest() # noqa: E501 - if include_optional: + # model = petstore_api.models.enum_test.EnumTest() # noqa: E501 + if include_optional : return EnumTest( - enum_string = 'UPPER', - enum_string_required = 'UPPER', - enum_integer_default = 1, - enum_integer = 1, - enum_number = 1.1, - outer_enum = 'placed', - outer_enum_integer = 2, - outer_enum_default_value = 'placed', - outer_enum_integer_default_value = -1 + enum_string = 'UPPER', + enum_string_required = 'UPPER', + enum_integer = 1, + enum_number = 1.1, + outer_enum = 'placed', + outer_enum_integer = 2, + outer_enum_default_value = 'placed', + outer_enum_integer_default_value = 0 ) - else: + else : return EnumTest( enum_string_required = 'UPPER', ) - """ def testEnumTest(self): """Test EnumTest""" diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_fake_api.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_fake_api.py index 0d3fca3d7556..cf074093f90d 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_fake_api.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_fake_api.py @@ -3,173 +3,144 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest +try: + from unittest.mock import patch +except ImportError: + from mock import patch +import petstore_api from petstore_api.api.fake_api import FakeApi # noqa: E501 class TestFakeApi(unittest.TestCase): """FakeApi unit test stubs""" - def setUp(self) -> None: - self.api = FakeApi() # noqa: E501 - - def tearDown(self) -> None: - pass + def setUp(self): + self.api = petstore_api.api.fake_api.FakeApi() # noqa: E501 - def test_fake_any_type_request_body(self) -> None: - """Test case for fake_any_type_request_body - - test any type request body # noqa: E501 - """ - pass - - def test_fake_enum_ref_query_parameter(self) -> None: - """Test case for fake_enum_ref_query_parameter - - test enum reference query parameter # noqa: E501 - """ + def tearDown(self): pass - def test_fake_health_get(self) -> None: + def test_fake_health_get(self): """Test case for fake_health_get Health check endpoint # noqa: E501 """ pass - def test_fake_http_signature_test(self) -> None: + def test_fake_http_signature_test(self): """Test case for fake_http_signature_test test http signature authentication # noqa: E501 """ pass - def test_fake_outer_boolean_serialize(self) -> None: + def test_fake_outer_boolean_serialize(self): """Test case for fake_outer_boolean_serialize """ pass - def test_fake_outer_composite_serialize(self) -> None: + def test_fake_outer_composite_serialize(self): """Test case for fake_outer_composite_serialize """ pass - def test_fake_outer_number_serialize(self) -> None: + def test_fake_outer_number_serialize(self): """Test case for fake_outer_number_serialize """ pass - def test_fake_outer_string_serialize(self) -> None: + def test_fake_outer_string_serialize(self): """Test case for fake_outer_string_serialize """ pass - def test_fake_property_enum_integer_serialize(self) -> None: - """Test case for fake_property_enum_integer_serialize - - """ - pass - - def test_fake_return_list_of_objects(self) -> None: - """Test case for fake_return_list_of_objects - - test returning list of objects # noqa: E501 - """ - pass - - def test_fake_uuid_example(self) -> None: - """Test case for fake_uuid_example - - test uuid example # noqa: E501 - """ - pass - - def test_test_body_with_binary(self) -> None: - """Test case for test_body_with_binary - - """ - pass - - def test_test_body_with_file_schema(self) -> None: + def test_test_body_with_file_schema(self): """Test case for test_body_with_file_schema """ pass - def test_test_body_with_query_params(self) -> None: + def test_test_body_with_query_params(self): """Test case for test_body_with_query_params """ pass - def test_test_client_model(self) -> None: + def test_test_client_model(self): """Test case for test_client_model To test \"client\" model # noqa: E501 """ pass - def test_test_date_time_query_parameter(self) -> None: - """Test case for test_date_time_query_parameter + def test_test_endpoint_parameters(self): + """Test case for test_endpoint_parameters + Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501 """ pass - def test_test_endpoint_parameters(self) -> None: - """Test case for test_endpoint_parameters + def test_test_enum_parameters(self): + """Test case for test_enum_parameters - Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501 + To test enum parameters # noqa: E501 """ pass - def test_test_group_parameters(self) -> None: + def test_test_group_parameters(self): """Test case for test_group_parameters Fake endpoint to test group parameters (optional) # noqa: E501 """ pass - def test_test_inline_additional_properties(self) -> None: + def test_test_inline_additional_properties(self): """Test case for test_inline_additional_properties test inline additionalProperties # noqa: E501 """ pass - def test_test_inline_freeform_additional_properties(self) -> None: - """Test case for test_inline_freeform_additional_properties - - test inline free-form additionalProperties # noqa: E501 - """ - pass - - def test_test_json_form_data(self) -> None: + def test_test_json_form_data(self): """Test case for test_json_form_data test json serialization of form data # noqa: E501 """ pass - def test_test_query_parameter_collection_format(self) -> None: + def test_test_query_parameter_collection_format(self): """Test case for test_query_parameter_collection_format """ pass + def test_headers_parameter(self): + """Test case for the _headers are passed by the user + + To test any optional parameter # noqa: E501 + """ + api = petstore_api.api.PetApi() + with patch("petstore_api.api_client.ApiClient.call_api") as mock_method: + value_headers = {"Header1": "value1"} + api.find_pets_by_status(["available"], _headers=value_headers) + args, _ = mock_method.call_args + self.assertEqual(args, ('/pet/findByStatus', 'GET', {}, [('status', ['available'])], {'Accept': 'application/json', 'Header1': 'value1'}) +) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_fake_classname_tags123_api.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_fake_classname_tags123_api.py index 25088624aea3..f54e0d06644f 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_fake_classname_tags123_api.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_fake_classname_tags123_api.py @@ -3,30 +3,32 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest -from petstore_api.api.fake_classname_tags123_api import FakeClassnameTags123Api # noqa: E501 +import petstore_api +from petstore_api.api.fake_classname_tags_123_api import FakeClassnameTags123Api # noqa: E501 +from petstore_api.rest import ApiException class TestFakeClassnameTags123Api(unittest.TestCase): """FakeClassnameTags123Api unit test stubs""" - def setUp(self) -> None: - self.api = FakeClassnameTags123Api() # noqa: E501 + def setUp(self): + self.api = petstore_api.api.fake_classname_tags_123_api.FakeClassnameTags123Api() # noqa: E501 - def tearDown(self) -> None: + def tearDown(self): pass - def test_test_classname(self) -> None: + def test_test_classname(self): """Test case for test_classname To test class name in snake case # noqa: E501 diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_fake_classname_tags_123_api.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_fake_classname_tags_123_api.py new file mode 100644 index 000000000000..f54e0d06644f --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_fake_classname_tags_123_api.py @@ -0,0 +1,40 @@ +# 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 unittest + +import petstore_api +from petstore_api.api.fake_classname_tags_123_api import FakeClassnameTags123Api # noqa: E501 +from petstore_api.rest import ApiException + + +class TestFakeClassnameTags123Api(unittest.TestCase): + """FakeClassnameTags123Api unit test stubs""" + + def setUp(self): + self.api = petstore_api.api.fake_classname_tags_123_api.FakeClassnameTags123Api() # noqa: E501 + + def tearDown(self): + pass + + def test_test_classname(self): + """Test case for test_classname + + To test class name in snake case # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_file.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_file.py index 0896f1869db5..3c9b91972d91 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_file.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_file.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.file import File # noqa: E501 +from petstore_api.rest import ApiException class TestFile(unittest.TestCase): """File unit test stubs""" @@ -26,27 +28,24 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> File: + def make_instance(self, include_optional): """Test File include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # uncomment below to create an instance of `File` - """ - model = File() # noqa: E501 - if include_optional: + # model = petstore_api.models.file.File() # noqa: E501 + if include_optional : return File( source_uri = '' ) - else: + else : return File( ) - """ def testFile(self): """Test File""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_file_schema_test_class.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_file_schema_test_class.py index 72963bf91d52..2834ddc05413 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_file_schema_test_class.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_file_schema_test_class.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.file_schema_test_class import FileSchemaTestClass # noqa: E501 +from petstore_api.rest import ApiException class TestFileSchemaTestClass(unittest.TestCase): """FileSchemaTestClass unit test stubs""" @@ -26,32 +28,29 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> FileSchemaTestClass: + def make_instance(self, include_optional): """Test FileSchemaTestClass include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # uncomment below to create an instance of `FileSchemaTestClass` - """ - model = FileSchemaTestClass() # noqa: E501 - if include_optional: + # model = petstore_api.models.file_schema_test_class.FileSchemaTestClass() # noqa: E501 + if include_optional : return FileSchemaTestClass( file = petstore_api.models.file.File( - source_uri = '', ), + source_uri = '', ), files = [ petstore_api.models.file.File( source_uri = '', ) ] ) - else: + else : return FileSchemaTestClass( ) - """ def testFileSchemaTestClass(self): """Test FileSchemaTestClass""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_first_ref.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_first_ref.py index a99fc7cfc796..bcec1c0334bf 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_first_ref.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_first_ref.py @@ -3,19 +3,23 @@ """ OpenAPI Petstore - This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 +""" + +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.first_ref import FirstRef # noqa: E501 +from petstore_api.rest import ApiException class TestFirstRef(unittest.TestCase): """FirstRef unit test stubs""" @@ -26,17 +30,17 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> FirstRef: + def make_instance(self, include_optional): """Test FirstRef include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `FirstRef` """ - model = FirstRef() # noqa: E501 - if include_optional: + model = petstore_api.models.first_ref.FirstRef() # noqa: E501 + if include_optional : return FirstRef( - category = '', + category = '', self_ref = petstore_api.models.second_ref.SecondRef( category = '', circular_ref = petstore_api.models.circular_reference_model.Circular-Reference-Model( @@ -44,7 +48,7 @@ def make_instance(self, include_optional) -> FirstRef: nested = petstore_api.models.first_ref.FirstRef( category = '', ), ), ) ) - else: + else : return FirstRef( ) """ diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_foo.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_foo.py index f92679671c7a..f592b1c37018 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_foo.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_foo.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.foo import Foo # noqa: E501 +from petstore_api.rest import ApiException class TestFoo(unittest.TestCase): """Foo unit test stubs""" @@ -26,27 +28,24 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> Foo: + def make_instance(self, include_optional): """Test Foo include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # uncomment below to create an instance of `Foo` - """ - model = Foo() # noqa: E501 - if include_optional: + # model = petstore_api.models.foo.Foo() # noqa: E501 + if include_optional : return Foo( bar = 'bar' ) - else: + else : return Foo( ) - """ def testFoo(self): """Test Foo""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_foo_get_default_response.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_foo_get_default_response.py index 3a024f8e6c70..d2cadc258d8e 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_foo_get_default_response.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_foo_get_default_response.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.foo_get_default_response import FooGetDefaultResponse # noqa: E501 +from petstore_api.rest import ApiException class TestFooGetDefaultResponse(unittest.TestCase): """FooGetDefaultResponse unit test stubs""" @@ -26,28 +28,25 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> FooGetDefaultResponse: + def make_instance(self, include_optional): """Test FooGetDefaultResponse include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # uncomment below to create an instance of `FooGetDefaultResponse` - """ - model = FooGetDefaultResponse() # noqa: E501 - if include_optional: + # model = petstore_api.models.foo_get_default_response.FooGetDefaultResponse() # noqa: E501 + if include_optional : return FooGetDefaultResponse( string = petstore_api.models.foo.Foo( bar = 'bar', ) ) - else: + else : return FooGetDefaultResponse( ) - """ def testFooGetDefaultResponse(self): """Test FooGetDefaultResponse""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_format_test.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_format_test.py index 72c8965d4914..6038ab41357b 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_format_test.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_format_test.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.format_test import FormatTest # noqa: E501 +from petstore_api.rest import ApiException class TestFormatTest(unittest.TestCase): """FormatTest unit test stubs""" @@ -26,46 +28,44 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> FormatTest: + def make_instance(self, include_optional): """Test FormatTest include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # uncomment below to create an instance of `FormatTest` - """ - model = FormatTest() # noqa: E501 - if include_optional: + # model = petstore_api.models.format_test.FormatTest() # noqa: E501 + if include_optional : return FormatTest( - integer = 10, - int32 = 20, - int64 = 56, - number = 32.1, - float = 54.3, - double = 67.8, - decimal = 1, - string = 'a', - string_with_double_quote_pattern = 'this is \"something\"', - byte = 'YQ==', - binary = bytes(b'blah'), - var_date = datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date(), - date_time = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - uuid = '72f98069-206d-4f12-9f12-3d1e525a8e84', - password = '0123456789', - pattern_with_digits = '0480728880', + integer = 10, + int32 = 20, + int64 = 56, + number = 132.1, + float = 54.3, + double = 67.8, + decimal = 1, + string = 'a', + byte = bytes("someting", 'utf-8'), + binary = bytes(b'blah'), + date = datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date(), + date_time = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + uuid = '72f98069-206d-4f12-9f12-3d1e525a8e84', + password = '0123456789', + pattern_with_digits = '0480728880', pattern_with_digits_and_delimiter = 'image_480' ) - else: + else : return FormatTest( - number = 32.1, - var_date = datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date(), + number = 122.1, + byte = bytes("someting", 'utf-8'), + date = datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date(), password = '0123456789', ) - """ def testFormatTest(self): """Test FormatTest""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) + inst_req_only = self.make_instance(include_optional=False) + # TODO + #inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_has_only_read_only.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_has_only_read_only.py index f106dda48d7e..2a8d2df6a0f8 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_has_only_read_only.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_has_only_read_only.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.has_only_read_only import HasOnlyReadOnly # noqa: E501 +from petstore_api.rest import ApiException class TestHasOnlyReadOnly(unittest.TestCase): """HasOnlyReadOnly unit test stubs""" @@ -26,28 +28,25 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> HasOnlyReadOnly: + def make_instance(self, include_optional): """Test HasOnlyReadOnly include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # uncomment below to create an instance of `HasOnlyReadOnly` - """ - model = HasOnlyReadOnly() # noqa: E501 - if include_optional: + # model = petstore_api.models.has_only_read_only.HasOnlyReadOnly() # noqa: E501 + if include_optional : return HasOnlyReadOnly( - bar = '', + bar = '', foo = '' ) - else: + else : return HasOnlyReadOnly( ) - """ def testHasOnlyReadOnly(self): """Test HasOnlyReadOnly""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_health_check_result.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_health_check_result.py index 4f36cde5f8b5..21c52053ea22 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_health_check_result.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_health_check_result.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.health_check_result import HealthCheckResult # noqa: E501 +from petstore_api.rest import ApiException class TestHealthCheckResult(unittest.TestCase): """HealthCheckResult unit test stubs""" @@ -26,27 +28,24 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> HealthCheckResult: + def make_instance(self, include_optional): """Test HealthCheckResult include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # uncomment below to create an instance of `HealthCheckResult` - """ - model = HealthCheckResult() # noqa: E501 - if include_optional: + # model = petstore_api.models.health_check_result.HealthCheckResult() # noqa: E501 + if include_optional : return HealthCheckResult( nullable_message = '' ) - else: + else : return HealthCheckResult( ) - """ def testHealthCheckResult(self): """Test HealthCheckResult""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_inner_dict_with_property.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_inner_dict_with_property.py index 1ba15fd984da..8a63b70d5524 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_inner_dict_with_property.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_inner_dict_with_property.py @@ -3,19 +3,23 @@ """ OpenAPI Petstore - This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 +""" + +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.inner_dict_with_property import InnerDictWithProperty # noqa: E501 +from petstore_api.rest import ApiException class TestInnerDictWithProperty(unittest.TestCase): """InnerDictWithProperty unit test stubs""" @@ -26,19 +30,19 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> InnerDictWithProperty: + def make_instance(self, include_optional): """Test InnerDictWithProperty include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `InnerDictWithProperty` """ - model = InnerDictWithProperty() # noqa: E501 - if include_optional: + model = petstore_api.models.inner_dict_with_property.InnerDictWithProperty() # noqa: E501 + if include_optional : return InnerDictWithProperty( a_property = None ) - else: + else : return InnerDictWithProperty( ) """ diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_int_or_string.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_int_or_string.py index 41bf80d02cb5..0de76602cb69 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_int_or_string.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_int_or_string.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 +""" import unittest import datetime +import petstore_api from petstore_api.models.int_or_string import IntOrString # noqa: E501 +from petstore_api.rest import ApiException class TestIntOrString(unittest.TestCase): """IntOrString unit test stubs""" @@ -26,18 +28,18 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> IntOrString: + def make_instance(self, include_optional): """Test IntOrString include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `IntOrString` """ - model = IntOrString() # noqa: E501 - if include_optional: + model = petstore_api.models.int_or_string.IntOrString() # noqa: E501 + if include_optional : return IntOrString( ) - else: + else : return IntOrString( ) """ diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_list.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_list.py index 63be8f9a3d3b..4c603a5e9b1e 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_list.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_list.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.list import List # noqa: E501 +from petstore_api.rest import ApiException class TestList(unittest.TestCase): """List unit test stubs""" @@ -26,27 +28,24 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> List: + def make_instance(self, include_optional): """Test List include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # uncomment below to create an instance of `List` - """ - model = List() # noqa: E501 - if include_optional: + # model = petstore_api.models.list.List() # noqa: E501 + if include_optional : return List( - var_123_list = '' + _123_list = '' ) - else: + else : return List( ) - """ def testList(self): """Test List""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_map_of_array_of_model.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_map_of_array_of_model.py index 2f88aa7935ad..31ad486f5c03 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_map_of_array_of_model.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_map_of_array_of_model.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 +""" import unittest import datetime +import petstore_api from petstore_api.models.map_of_array_of_model import MapOfArrayOfModel # noqa: E501 +from petstore_api.rest import ApiException class TestMapOfArrayOfModel(unittest.TestCase): """MapOfArrayOfModel unit test stubs""" @@ -26,15 +28,15 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> MapOfArrayOfModel: + def make_instance(self, include_optional): """Test MapOfArrayOfModel include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `MapOfArrayOfModel` """ - model = MapOfArrayOfModel() # noqa: E501 - if include_optional: + model = petstore_api.models.map_of_array_of_model.MapOfArrayOfModel() # noqa: E501 + if include_optional : return MapOfArrayOfModel( shop_id_to_org_online_lip_map = { 'key' : [ @@ -44,7 +46,7 @@ def make_instance(self, include_optional) -> MapOfArrayOfModel: ] } ) - else: + else : return MapOfArrayOfModel( ) """ diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_map_test.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_map_test.py index 8aedbfa8f665..5e11fed312ad 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_map_test.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_map_test.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.map_test import MapTest # noqa: E501 +from petstore_api.rest import ApiException class TestMapTest(unittest.TestCase): """MapTest unit test stubs""" @@ -26,40 +28,38 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> MapTest: + def make_instance(self, include_optional): """Test MapTest include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # uncomment below to create an instance of `MapTest` - """ - model = MapTest() # noqa: E501 - if include_optional: + # model = petstore_api.models.map_test.MapTest() # noqa: E501 + if include_optional : return MapTest( map_map_of_string = { 'key' : { 'key' : '' } - }, + }, map_of_enum_string = { 'UPPER' : 'UPPER' - }, + }, direct_map = { 'key' : True - }, + }, indirect_map = { 'key' : True } ) - else: + else : return MapTest( ) - """ def testMapTest(self): """Test MapTest""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) + # TODO + #inst_req_only = self.make_instance(include_optional=False) + #inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_mixed_properties_and_additional_properties_class.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_mixed_properties_and_additional_properties_class.py index 12a96998a561..d217b1143656 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_mixed_properties_and_additional_properties_class.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_mixed_properties_and_additional_properties_class.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass # noqa: E501 +from petstore_api.rest import ApiException class TestMixedPropertiesAndAdditionalPropertiesClass(unittest.TestCase): """MixedPropertiesAndAdditionalPropertiesClass unit test stubs""" @@ -26,33 +28,30 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> MixedPropertiesAndAdditionalPropertiesClass: + def make_instance(self, include_optional): """Test MixedPropertiesAndAdditionalPropertiesClass include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # uncomment below to create an instance of `MixedPropertiesAndAdditionalPropertiesClass` - """ - model = MixedPropertiesAndAdditionalPropertiesClass() # noqa: E501 - if include_optional: + # model = petstore_api.models.mixed_properties_and_additional_properties_class.MixedPropertiesAndAdditionalPropertiesClass() # noqa: E501 + if include_optional : return MixedPropertiesAndAdditionalPropertiesClass( - uuid = '', - date_time = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + uuid = '', + date_time = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), map = { 'key' : petstore_api.models.animal.Animal( class_name = '', color = 'red', ) } ) - else: + else : return MixedPropertiesAndAdditionalPropertiesClass( ) - """ def testMixedPropertiesAndAdditionalPropertiesClass(self): """Test MixedPropertiesAndAdditionalPropertiesClass""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_model200_response.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_model200_response.py index f5e65f1aca4e..f7e9677e0074 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_model200_response.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_model200_response.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.model200_response import Model200Response # noqa: E501 +from petstore_api.rest import ApiException class TestModel200Response(unittest.TestCase): """Model200Response unit test stubs""" @@ -26,28 +28,25 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> Model200Response: + def make_instance(self, include_optional): """Test Model200Response include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # uncomment below to create an instance of `Model200Response` - """ - model = Model200Response() # noqa: E501 - if include_optional: + # model = petstore_api.models.model200_response.Model200Response() # noqa: E501 + if include_optional : return Model200Response( - name = 56, - var_class = '' + name = 56, + _class = '' ) - else: + else : return Model200Response( ) - """ def testModel200Response(self): """Test Model200Response""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_model_return.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_model_return.py index e011892fb0b3..b0f9d9c4f7f9 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_model_return.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_model_return.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.model_return import ModelReturn # noqa: E501 +from petstore_api.rest import ApiException class TestModelReturn(unittest.TestCase): """ModelReturn unit test stubs""" @@ -26,27 +28,24 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> ModelReturn: + def make_instance(self, include_optional): """Test ModelReturn include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # uncomment below to create an instance of `ModelReturn` - """ - model = ModelReturn() # noqa: E501 - if include_optional: + # model = petstore_api.models.model_return.ModelReturn() # noqa: E501 + if include_optional : return ModelReturn( - var_return = 56 + _return = 56 ) - else: + else : return ModelReturn( ) - """ def testModelReturn(self): """Test ModelReturn""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_name.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_name.py index be7ddc8461d1..bbf11fd231ea 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_name.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_name.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.name import Name # noqa: E501 +from petstore_api.rest import ApiException class TestName(unittest.TestCase): """Name unit test stubs""" @@ -26,31 +28,28 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> Name: + def make_instance(self, include_optional): """Test Name include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # uncomment below to create an instance of `Name` - """ - model = Name() # noqa: E501 - if include_optional: + # model = petstore_api.models.name.Name() # noqa: E501 + if include_optional : return Name( - name = 56, - snake_case = 56, - var_property = '', - var_123_number = 56 + name = 56, + snake_case = 56, + _property = '', + _123_number = 56 ) - else: + else : return Name( name = 56, ) - """ def testName(self): """Test Name""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_nullable_class.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_nullable_class.py index b1170db23c4d..7aa59f46bbd8 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_nullable_class.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_nullable_class.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.nullable_class import NullableClass # noqa: E501 +from petstore_api.rest import ApiException class TestNullableClass(unittest.TestCase): """NullableClass unit test stubs""" @@ -26,52 +28,50 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> NullableClass: + def make_instance(self, include_optional): """Test NullableClass include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # uncomment below to create an instance of `NullableClass` - """ - model = NullableClass() # noqa: E501 - if include_optional: + # model = petstore_api.models.nullable_class.NullableClass() # noqa: E501 + if include_optional : return NullableClass( required_integer_prop = 56, - integer_prop = 56, - number_prop = 1.337, - boolean_prop = True, - string_prop = '', - date_prop = datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date(), - datetime_prop = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + integer_prop = 56, + number_prop = 1.337, + boolean_prop = True, + string_prop = '', + date_prop = datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date(), + datetime_prop = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), array_nullable_prop = [ None - ], + ], array_and_items_nullable_prop = [ None - ], + ], array_items_nullable = [ None - ], + ], object_nullable_prop = { 'key' : None - }, + }, object_and_items_nullable_prop = { 'key' : None - }, + }, object_items_nullable = { 'key' : None } ) - else: + else : return NullableClass( - required_integer_prop = 56, + required_integer_prop = 56 ) - """ def testNullableClass(self): """Test NullableClass""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) + # TODO + #inst_req_only = self.make_instance(include_optional=False) + #inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_nullable_property.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_nullable_property.py index aa34b84e7973..34129457b1d7 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_nullable_property.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_nullable_property.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 +""" import unittest import datetime +import petstore_api from petstore_api.models.nullable_property import NullableProperty # noqa: E501 +from petstore_api.rest import ApiException class TestNullableProperty(unittest.TestCase): """NullableProperty unit test stubs""" @@ -26,20 +28,20 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> NullableProperty: + def make_instance(self, include_optional): """Test NullableProperty include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `NullableProperty` """ - model = NullableProperty() # noqa: E501 - if include_optional: + model = petstore_api.models.nullable_property.NullableProperty() # noqa: E501 + if include_optional : return NullableProperty( - id = 56, + id = 56, name = 'AUR,rZ#UM/?R,Fp^l6$ARjbhJk C>' ) - else: + else : return NullableProperty( id = 56, name = 'AUR,rZ#UM/?R,Fp^l6$ARjbhJk C>', diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_number_only.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_number_only.py index cfc8c5c778c4..776946c3d774 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_number_only.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_number_only.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.number_only import NumberOnly # noqa: E501 +from petstore_api.rest import ApiException class TestNumberOnly(unittest.TestCase): """NumberOnly unit test stubs""" @@ -26,27 +28,24 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> NumberOnly: + def make_instance(self, include_optional): """Test NumberOnly include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # uncomment below to create an instance of `NumberOnly` - """ - model = NumberOnly() # noqa: E501 - if include_optional: + # model = petstore_api.models.number_only.NumberOnly() # noqa: E501 + if include_optional : return NumberOnly( just_number = 1.337 ) - else: + else : return NumberOnly( ) - """ def testNumberOnly(self): """Test NumberOnly""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_object_to_test_additional_properties.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_object_to_test_additional_properties.py index d080b21afb32..f1f354cad251 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_object_to_test_additional_properties.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_object_to_test_additional_properties.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 +""" import unittest import datetime +import petstore_api from petstore_api.models.object_to_test_additional_properties import ObjectToTestAdditionalProperties # noqa: E501 +from petstore_api.rest import ApiException class TestObjectToTestAdditionalProperties(unittest.TestCase): """ObjectToTestAdditionalProperties unit test stubs""" @@ -26,19 +28,19 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> ObjectToTestAdditionalProperties: + def make_instance(self, include_optional): """Test ObjectToTestAdditionalProperties include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `ObjectToTestAdditionalProperties` """ - model = ObjectToTestAdditionalProperties() # noqa: E501 - if include_optional: + model = petstore_api.models.object_to_test_additional_properties.ObjectToTestAdditionalProperties() # noqa: E501 + if include_optional : return ObjectToTestAdditionalProperties( var_property = True ) - else: + else : return ObjectToTestAdditionalProperties( ) """ diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_object_with_deprecated_fields.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_object_with_deprecated_fields.py index 5f04c63a3cb3..e0cbf3e98a51 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_object_with_deprecated_fields.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_object_with_deprecated_fields.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.object_with_deprecated_fields import ObjectWithDeprecatedFields # noqa: E501 +from petstore_api.rest import ApiException class TestObjectWithDeprecatedFields(unittest.TestCase): """ObjectWithDeprecatedFields unit test stubs""" @@ -26,33 +28,30 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> ObjectWithDeprecatedFields: + def make_instance(self, include_optional): """Test ObjectWithDeprecatedFields include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # uncomment below to create an instance of `ObjectWithDeprecatedFields` - """ - model = ObjectWithDeprecatedFields() # noqa: E501 - if include_optional: + # model = petstore_api.models.object_with_deprecated_fields.ObjectWithDeprecatedFields() # noqa: E501 + if include_optional : return ObjectWithDeprecatedFields( - uuid = '', - id = 1.337, + uuid = '', + id = 1.337, deprecated_ref = petstore_api.models.deprecated_object.DeprecatedObject( - name = '', ), + name = '', ), bars = [ 'bar' ] ) - else: + else : return ObjectWithDeprecatedFields( ) - """ def testObjectWithDeprecatedFields(self): """Test ObjectWithDeprecatedFields""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_one_of_enum_string.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_one_of_enum_string.py index 3db614a16caf..ed959c1479c2 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_one_of_enum_string.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_one_of_enum_string.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 +""" import unittest import datetime +import petstore_api from petstore_api.models.one_of_enum_string import OneOfEnumString # noqa: E501 +from petstore_api.rest import ApiException class TestOneOfEnumString(unittest.TestCase): """OneOfEnumString unit test stubs""" @@ -26,18 +28,18 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> OneOfEnumString: + def make_instance(self, include_optional): """Test OneOfEnumString include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `OneOfEnumString` """ - model = OneOfEnumString() # noqa: E501 - if include_optional: + model = petstore_api.models.one_of_enum_string.OneOfEnumString() # noqa: E501 + if include_optional : return OneOfEnumString( ) - else: + else : return OneOfEnumString( ) """ diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_order.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_order.py index 3334ed8f949a..d6ec36f83a0d 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_order.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_order.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.order import Order # noqa: E501 +from petstore_api.rest import ApiException class TestOrder(unittest.TestCase): """Order unit test stubs""" @@ -26,32 +28,29 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> Order: + def make_instance(self, include_optional): """Test Order include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # uncomment below to create an instance of `Order` - """ - model = Order() # noqa: E501 - if include_optional: + # model = petstore_api.models.order.Order() # noqa: E501 + if include_optional : return Order( - id = 56, - pet_id = 56, - quantity = 56, - ship_date = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - status = 'placed', + id = 56, + pet_id = 56, + quantity = 56, + ship_date = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + status = 'placed', complete = True ) - else: + else : return Order( ) - """ def testOrder(self): """Test Order""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_composite.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_composite.py index 7df32d8c6725..c6fd58849377 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_composite.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_composite.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.outer_composite import OuterComposite # noqa: E501 +from petstore_api.rest import ApiException class TestOuterComposite(unittest.TestCase): """OuterComposite unit test stubs""" @@ -26,29 +28,26 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> OuterComposite: + def make_instance(self, include_optional): """Test OuterComposite include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # uncomment below to create an instance of `OuterComposite` - """ - model = OuterComposite() # noqa: E501 - if include_optional: + # model = petstore_api.models.outer_composite.OuterComposite() # noqa: E501 + if include_optional : return OuterComposite( - my_number = 1.337, - my_string = '', + my_number = 1.337, + my_string = '', my_boolean = True ) - else: + else : return OuterComposite( ) - """ def testOuterComposite(self): """Test OuterComposite""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_enum.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_enum.py index 5da04a9a45c0..aa195260019e 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_enum.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_enum.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.outer_enum import OuterEnum # noqa: E501 +from petstore_api.rest import ApiException class TestOuterEnum(unittest.TestCase): """OuterEnum unit test stubs""" @@ -28,7 +30,7 @@ def tearDown(self): def testOuterEnum(self): """Test OuterEnum""" - # inst = OuterEnum() + inst = OuterEnum("placed") if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_enum_default_value.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_enum_default_value.py index df6499565fdb..f8fba3bd79ad 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_enum_default_value.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_enum_default_value.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.outer_enum_default_value import OuterEnumDefaultValue # noqa: E501 +from petstore_api.rest import ApiException class TestOuterEnumDefaultValue(unittest.TestCase): """OuterEnumDefaultValue unit test stubs""" diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_enum_integer.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_enum_integer.py index 7b89b806ba24..ce1e47c61b14 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_enum_integer.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_enum_integer.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.outer_enum_integer import OuterEnumInteger # noqa: E501 +from petstore_api.rest import ApiException class TestOuterEnumInteger(unittest.TestCase): """OuterEnumInteger unit test stubs""" diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_enum_integer_default_value.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_enum_integer_default_value.py index 532616fdee1f..f0b707fca778 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_enum_integer_default_value.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_enum_integer_default_value.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.outer_enum_integer_default_value import OuterEnumIntegerDefaultValue # noqa: E501 +from petstore_api.rest import ApiException class TestOuterEnumIntegerDefaultValue(unittest.TestCase): """OuterEnumIntegerDefaultValue unit test stubs""" @@ -26,9 +28,23 @@ def setUp(self): def tearDown(self): pass + def make_instance(self, include_optional): + """Test OuterEnumIntegerDefaultValue + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # model = petstore_api.models.outer_enum_integer_default_value.OuterEnumIntegerDefaultValue() # noqa: E501 + if include_optional : + return OuterEnumIntegerDefaultValue( + ) + else : + return OuterEnumIntegerDefaultValue( + ) + def testOuterEnumIntegerDefaultValue(self): """Test OuterEnumIntegerDefaultValue""" - # inst = OuterEnumIntegerDefaultValue() + #inst_req_only = self.make_instance(include_optional=False) + #inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_object_with_enum_property.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_object_with_enum_property.py index 27e518b00593..35258d5d74ac 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_object_with_enum_property.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_object_with_enum_property.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.outer_object_with_enum_property import OuterObjectWithEnumProperty # noqa: E501 +from petstore_api.rest import ApiException class TestOuterObjectWithEnumProperty(unittest.TestCase): """OuterObjectWithEnumProperty unit test stubs""" @@ -26,24 +28,20 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> OuterObjectWithEnumProperty: + def make_instance(self, include_optional): """Test OuterObjectWithEnumProperty include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # uncomment below to create an instance of `OuterObjectWithEnumProperty` - """ - model = OuterObjectWithEnumProperty() # noqa: E501 - if include_optional: + # model = petstore_api.models.outer_object_with_enum_property.OuterObjectWithEnumProperty() # noqa: E501 + if include_optional : return OuterObjectWithEnumProperty( - str_value = 'placed', value = 2 ) - else: + else : return OuterObjectWithEnumProperty( value = 2, ) - """ def testOuterObjectWithEnumProperty(self): """Test OuterObjectWithEnumProperty""" diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_parent.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_parent.py index ea206970c9cf..2a74505f08a1 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_parent.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_parent.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 +""" import unittest import datetime +import petstore_api from petstore_api.models.parent import Parent # noqa: E501 +from petstore_api.rest import ApiException class TestParent(unittest.TestCase): """Parent unit test stubs""" @@ -26,22 +28,22 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> Parent: + def make_instance(self, include_optional): """Test Parent include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Parent` """ - model = Parent() # noqa: E501 - if include_optional: + model = petstore_api.models.parent.Parent() # noqa: E501 + if include_optional : return Parent( optional_dict = { 'key' : petstore_api.models.inner_dict_with_property.InnerDictWithProperty( a_property = petstore_api.models.a_property.aProperty(), ) } ) - else: + else : return Parent( ) """ diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_parent_with_optional_dict.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_parent_with_optional_dict.py index 2c668a7047a8..25b769e3d390 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_parent_with_optional_dict.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_parent_with_optional_dict.py @@ -3,19 +3,23 @@ """ OpenAPI Petstore - This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 +""" + +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.parent_with_optional_dict import ParentWithOptionalDict # noqa: E501 +from petstore_api.rest import ApiException class TestParentWithOptionalDict(unittest.TestCase): """ParentWithOptionalDict unit test stubs""" @@ -26,22 +30,22 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> ParentWithOptionalDict: + def make_instance(self, include_optional): """Test ParentWithOptionalDict include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `ParentWithOptionalDict` """ - model = ParentWithOptionalDict() # noqa: E501 - if include_optional: + model = petstore_api.models.parent_with_optional_dict.ParentWithOptionalDict() # noqa: E501 + if include_optional : return ParentWithOptionalDict( optional_dict = { 'key' : petstore_api.models.inner_dict_with_property.InnerDictWithProperty( a_property = petstore_api.models.a_property.aProperty(), ) } ) - else: + else : return ParentWithOptionalDict( ) """ diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_pet.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_pet.py index f89e6cdf4b40..6d3fd2f35b04 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_pet.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_pet.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.pet import Pet # noqa: E501 +from petstore_api.rest import ApiException class TestPet(unittest.TestCase): """Pet unit test stubs""" @@ -26,44 +28,41 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> Pet: + def make_instance(self, include_optional): """Test Pet include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # uncomment below to create an instance of `Pet` - """ - model = Pet() # noqa: E501 - if include_optional: + # model = petstore_api.models.pet.Pet() # noqa: E501 + if include_optional : return Pet( - id = 56, + id = 56, category = petstore_api.models.category.Category( id = 56, - name = 'default-name', ), - name = 'doggie', + name = 'default-name', ), + name = 'doggie', photo_urls = [ '' - ], + ], tags = [ petstore_api.models.tag.Tag( id = 56, name = '', ) - ], + ], status = 'available' ) - else: + else : return Pet( name = 'doggie', photo_urls = [ '' ], ) - """ def testPet(self): """Test Pet""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_pet_api.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_pet_api.py index 2352eb7ab403..77665df879f1 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_pet_api.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_pet_api.py @@ -3,86 +3,88 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest +import petstore_api from petstore_api.api.pet_api import PetApi # noqa: E501 +from petstore_api.rest import ApiException class TestPetApi(unittest.TestCase): """PetApi unit test stubs""" - def setUp(self) -> None: - self.api = PetApi() # noqa: E501 + def setUp(self): + self.api = petstore_api.api.pet_api.PetApi() # noqa: E501 - def tearDown(self) -> None: + def tearDown(self): pass - def test_add_pet(self) -> None: + def test_add_pet(self): """Test case for add_pet Add a new pet to the store # noqa: E501 """ pass - def test_delete_pet(self) -> None: + def test_delete_pet(self): """Test case for delete_pet Deletes a pet # noqa: E501 """ pass - def test_find_pets_by_status(self) -> None: + def test_find_pets_by_status(self): """Test case for find_pets_by_status Finds Pets by status # noqa: E501 """ pass - def test_find_pets_by_tags(self) -> None: + def test_find_pets_by_tags(self): """Test case for find_pets_by_tags Finds Pets by tags # noqa: E501 """ pass - def test_get_pet_by_id(self) -> None: + def test_get_pet_by_id(self): """Test case for get_pet_by_id Find pet by ID # noqa: E501 """ pass - def test_update_pet(self) -> None: + def test_update_pet(self): """Test case for update_pet Update an existing pet # noqa: E501 """ pass - def test_update_pet_with_form(self) -> None: + def test_update_pet_with_form(self): """Test case for update_pet_with_form Updates a pet in the store with form data # noqa: E501 """ pass - def test_upload_file(self) -> None: + def test_upload_file(self): """Test case for upload_file uploads an image # noqa: E501 """ pass - def test_upload_file_with_required_file(self) -> None: + def test_upload_file_with_required_file(self): """Test case for upload_file_with_required_file uploads an image (required) # noqa: E501 diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_pig.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_pig.py index cd3f112aabc5..95e99f35a738 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_pig.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_pig.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.pig import Pig # noqa: E501 +from petstore_api.rest import ApiException class TestPig(unittest.TestCase): """Pig unit test stubs""" @@ -26,28 +28,6 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> Pig: - """Test Pig - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `Pig` - """ - model = Pig() # noqa: E501 - if include_optional: - return Pig( - class_name = '', - color = '', - size = 56 - ) - else: - return Pig( - class_name = '', - color = '', - size = 56, - ) - """ - def testPig(self): """Test Pig""" # inst_req_only = self.make_instance(include_optional=False) diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_property_name_collision.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_property_name_collision.py index a869945b3204..04ab956f191d 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_property_name_collision.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_property_name_collision.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 +""" import unittest import datetime +import petstore_api from petstore_api.models.property_name_collision import PropertyNameCollision # noqa: E501 +from petstore_api.rest import ApiException class TestPropertyNameCollision(unittest.TestCase): """PropertyNameCollision unit test stubs""" @@ -26,21 +28,21 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> PropertyNameCollision: + def make_instance(self, include_optional): """Test PropertyNameCollision include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `PropertyNameCollision` """ - model = PropertyNameCollision() # noqa: E501 - if include_optional: + model = petstore_api.models.property_name_collision.PropertyNameCollision() # noqa: E501 + if include_optional : return PropertyNameCollision( - underscore_type = '', - type = '', - type_with_underscore = '' + underscoreType = '', + type = '', + typeWithUnderscore = '' ) - else: + else : return PropertyNameCollision( ) """ diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_read_only_first.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_read_only_first.py index 1026a73205d4..310e4b1aebbe 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_read_only_first.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_read_only_first.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.read_only_first import ReadOnlyFirst # noqa: E501 +from petstore_api.rest import ApiException class TestReadOnlyFirst(unittest.TestCase): """ReadOnlyFirst unit test stubs""" @@ -26,28 +28,25 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> ReadOnlyFirst: + def make_instance(self, include_optional): """Test ReadOnlyFirst include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # uncomment below to create an instance of `ReadOnlyFirst` - """ - model = ReadOnlyFirst() # noqa: E501 - if include_optional: + # model = petstore_api.models.read_only_first.ReadOnlyFirst() # noqa: E501 + if include_optional : return ReadOnlyFirst( - bar = '', + bar = '', baz = '' ) - else: + else : return ReadOnlyFirst( ) - """ def testReadOnlyFirst(self): """Test ReadOnlyFirst""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_second_ref.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_second_ref.py index 44194f94544f..782892fd4e17 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_second_ref.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_second_ref.py @@ -3,19 +3,23 @@ """ OpenAPI Petstore - This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 +""" + +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.second_ref import SecondRef # noqa: E501 +from petstore_api.rest import ApiException class TestSecondRef(unittest.TestCase): """SecondRef unit test stubs""" @@ -26,17 +30,17 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> SecondRef: + def make_instance(self, include_optional): """Test SecondRef include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `SecondRef` """ - model = SecondRef() # noqa: E501 - if include_optional: + model = petstore_api.models.second_ref.SecondRef() # noqa: E501 + if include_optional : return SecondRef( - category = '', + category = '', circular_ref = petstore_api.models.circular_reference_model.Circular-Reference-Model( size = 56, nested = petstore_api.models.first_ref.FirstRef( @@ -44,7 +48,7 @@ def make_instance(self, include_optional) -> SecondRef: self_ref = petstore_api.models.second_ref.SecondRef( category = '', ), ), ) ) - else: + else : return SecondRef( ) """ diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_self_reference_model.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_self_reference_model.py index 8c23008b26ed..b3dd7ada2b2a 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_self_reference_model.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_self_reference_model.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.self_reference_model import SelfReferenceModel # noqa: E501 +from petstore_api.rest import ApiException class TestSelfReferenceModel(unittest.TestCase): """SelfReferenceModel unit test stubs""" @@ -26,17 +28,17 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> SelfReferenceModel: + def make_instance(self, include_optional): """Test SelfReferenceModel include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `SelfReferenceModel` """ - model = SelfReferenceModel() # noqa: E501 - if include_optional: + model = petstore_api.models.self_reference_model.SelfReferenceModel() # noqa: E501 + if include_optional : return SelfReferenceModel( - size = 56, + size = 56, nested = petstore_api.models.dummy_model.Dummy-Model( category = '', self_ref = petstore_api.models.self_reference_model.Self-Reference-Model( @@ -44,7 +46,7 @@ def make_instance(self, include_optional) -> SelfReferenceModel: nested = petstore_api.models.dummy_model.Dummy-Model( category = '', ), ), ) ) - else: + else : return SelfReferenceModel( ) """ diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_single_ref_type.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_single_ref_type.py index f5642b8376b0..888a1a7b6da3 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_single_ref_type.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_single_ref_type.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.single_ref_type import SingleRefType # noqa: E501 +from petstore_api.rest import ApiException class TestSingleRefType(unittest.TestCase): """SingleRefType unit test stubs""" @@ -26,9 +28,23 @@ def setUp(self): def tearDown(self): pass + def make_instance(self, include_optional): + """Test SingleRefType + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # model = petstore_api.models.single_ref_type.SingleRefType() # noqa: E501 + if include_optional : + return SingleRefType( + ) + else : + return SingleRefType( + ) + def testSingleRefType(self): """Test SingleRefType""" - # inst = SingleRefType() + #inst_req_only = self.make_instance(include_optional=False) + #inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_special_character_enum.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_special_character_enum.py index ee5baab13095..028f55599e49 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_special_character_enum.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_special_character_enum.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.special_character_enum import SpecialCharacterEnum # noqa: E501 +from petstore_api.rest import ApiException class TestSpecialCharacterEnum(unittest.TestCase): """SpecialCharacterEnum unit test stubs""" diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_special_model_name.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_special_model_name.py index 12ec90a9067f..eb487cd42fc1 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_special_model_name.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_special_model_name.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.special_model_name import SpecialModelName # noqa: E501 +from petstore_api.rest import ApiException class TestSpecialModelName(unittest.TestCase): """SpecialModelName unit test stubs""" @@ -26,27 +28,24 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> SpecialModelName: + def make_instance(self, include_optional): """Test SpecialModelName include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # uncomment below to create an instance of `SpecialModelName` - """ - model = SpecialModelName() # noqa: E501 - if include_optional: + # model = petstore_api.models.special_model_name.SpecialModelName() # noqa: E501 + if include_optional : return SpecialModelName( special_property_name = 56 ) - else: + else : return SpecialModelName( ) - """ def testSpecialModelName(self): """Test SpecialModelName""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_special_name.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_special_name.py index afaf0996b74c..1f4287871a8e 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_special_name.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_special_name.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.special_name import SpecialName # noqa: E501 +from petstore_api.rest import ApiException class TestSpecialName(unittest.TestCase): """SpecialName unit test stubs""" @@ -26,23 +28,23 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> SpecialName: + def make_instance(self, include_optional): """Test SpecialName include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `SpecialName` """ - model = SpecialName() # noqa: E501 - if include_optional: + model = petstore_api.models.special_name.SpecialName() # noqa: E501 + if include_optional : return SpecialName( - var_property = 56, + var_property = 56, var_async = petstore_api.models.category.Category( id = 56, - name = 'default-name', ), - var_schema = 'available' + name = 'default-name', ), + status = 'available' ) - else: + else : return SpecialName( ) """ diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_store_api.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_store_api.py index c25309ee006c..81848d24a67e 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_store_api.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_store_api.py @@ -3,51 +3,53 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest +import petstore_api from petstore_api.api.store_api import StoreApi # noqa: E501 +from petstore_api.rest import ApiException class TestStoreApi(unittest.TestCase): """StoreApi unit test stubs""" - def setUp(self) -> None: - self.api = StoreApi() # noqa: E501 + def setUp(self): + self.api = petstore_api.api.store_api.StoreApi() # noqa: E501 - def tearDown(self) -> None: + def tearDown(self): pass - def test_delete_order(self) -> None: + def test_delete_order(self): """Test case for delete_order Delete purchase order by ID # noqa: E501 """ pass - def test_get_inventory(self) -> None: + def test_get_inventory(self): """Test case for get_inventory Returns pet inventories by status # noqa: E501 """ pass - def test_get_order_by_id(self) -> None: + def test_get_order_by_id(self): """Test case for get_order_by_id Find purchase order by ID # noqa: E501 """ pass - def test_place_order(self) -> None: + def test_place_order(self): """Test case for place_order Place an order for a pet # noqa: E501 diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_tag.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_tag.py index d5ce3fb8a0cf..9680300032f1 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_tag.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_tag.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.tag import Tag # noqa: E501 +from petstore_api.rest import ApiException class TestTag(unittest.TestCase): """Tag unit test stubs""" @@ -26,28 +28,25 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> Tag: + def make_instance(self, include_optional): """Test Tag include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # uncomment below to create an instance of `Tag` - """ - model = Tag() # noqa: E501 - if include_optional: + # model = petstore_api.models.tag.Tag() # noqa: E501 + if include_optional : return Tag( - id = 56, + id = 56, name = '' ) - else: + else : return Tag( ) - """ def testTag(self): """Test Tag""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_tiger.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_tiger.py index 7aab61a46066..83c91cea1a0d 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_tiger.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_tiger.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 +""" import unittest import datetime +import petstore_api from petstore_api.models.tiger import Tiger # noqa: E501 +from petstore_api.rest import ApiException class TestTiger(unittest.TestCase): """Tiger unit test stubs""" @@ -26,19 +28,19 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> Tiger: + def make_instance(self, include_optional): """Test Tiger include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Tiger` """ - model = Tiger() # noqa: E501 - if include_optional: + model = petstore_api.models.tiger.Tiger() # noqa: E501 + if include_optional : return Tiger( skill = '' ) - else: + else : return Tiger( ) """ diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_user.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_user.py index a1ce46e87a19..174c8e06be5d 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_user.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_user.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.user import User # noqa: E501 +from petstore_api.rest import ApiException class TestUser(unittest.TestCase): """User unit test stubs""" @@ -26,34 +28,31 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> User: + def make_instance(self, include_optional): """Test User include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # uncomment below to create an instance of `User` - """ - model = User() # noqa: E501 - if include_optional: + # model = petstore_api.models.user.User() # noqa: E501 + if include_optional : return User( - id = 56, - username = '', - first_name = '', - last_name = '', - email = '', - password = '', - phone = '', + id = 56, + username = '', + first_name = '', + last_name = '', + email = '', + password = '', + phone = '', user_status = 56 ) - else: + else : return User( ) - """ def testUser(self): """Test User""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_user_api.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_user_api.py index 28103bb27ea2..6df730fba2b1 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_user_api.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_user_api.py @@ -3,79 +3,81 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest +import petstore_api from petstore_api.api.user_api import UserApi # noqa: E501 +from petstore_api.rest import ApiException class TestUserApi(unittest.TestCase): """UserApi unit test stubs""" - def setUp(self) -> None: - self.api = UserApi() # noqa: E501 + def setUp(self): + self.api = petstore_api.api.user_api.UserApi() # noqa: E501 - def tearDown(self) -> None: + def tearDown(self): pass - def test_create_user(self) -> None: + def test_create_user(self): """Test case for create_user Create user # noqa: E501 """ pass - def test_create_users_with_array_input(self) -> None: + def test_create_users_with_array_input(self): """Test case for create_users_with_array_input Creates list of users with given input array # noqa: E501 """ pass - def test_create_users_with_list_input(self) -> None: + def test_create_users_with_list_input(self): """Test case for create_users_with_list_input Creates list of users with given input array # noqa: E501 """ pass - def test_delete_user(self) -> None: + def test_delete_user(self): """Test case for delete_user Delete user # noqa: E501 """ pass - def test_get_user_by_name(self) -> None: + def test_get_user_by_name(self): """Test case for get_user_by_name Get user by user name # noqa: E501 """ pass - def test_login_user(self) -> None: + def test_login_user(self): """Test case for login_user Logs user into the system # noqa: E501 """ pass - def test_logout_user(self) -> None: + def test_logout_user(self): """Test case for logout_user Logs out current logged in user session # noqa: E501 """ pass - def test_update_user(self) -> None: + def test_update_user(self): """Test case for update_user Updated user # noqa: E501 diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_with_nested_one_of.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_with_nested_one_of.py index 43c4a69a29bb..994004dd7ab7 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_with_nested_one_of.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_with_nested_one_of.py @@ -3,19 +3,21 @@ """ 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: \" \\ + 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 OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import petstore_api from petstore_api.models.with_nested_one_of import WithNestedOneOf # noqa: E501 +from petstore_api.rest import ApiException class TestWithNestedOneOf(unittest.TestCase): """WithNestedOneOf unit test stubs""" @@ -26,29 +28,25 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> WithNestedOneOf: + def make_instance(self, include_optional): """Test WithNestedOneOf include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # uncomment below to create an instance of `WithNestedOneOf` - """ - model = WithNestedOneOf() # noqa: E501 - if include_optional: + # model = petstore_api.models.with_nested_one_of.WithNestedOneOf() # noqa: E501 + if include_optional : return WithNestedOneOf( - size = 56, - nested_pig = None, - nested_oneof_enum_string = None + size = 56, + nested_pig = None ) - else: + else : return WithNestedOneOf( ) - """ def testWithNestedOneOf(self): """Test WithNestedOneOf""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) + #inst_req_only = self.make_instance(include_optional=False) + #inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test_python3.sh b/samples/openapi3/client/petstore/python-pydantic-v1/test_python3.sh new file mode 100755 index 000000000000..f617f3adfa64 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test_python3.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +REQUIREMENTS_FILE=dev-requirements.txt +REQUIREMENTS_OUT=dev-requirements.txt.log +SETUP_OUT=*.egg-info +VENV=venv +DEACTIVE=false + +export LC_ALL=en_US.UTF-8 +export LANG=en_US.UTF-8 + +### set virtualenv +if [ -z "$VIRTUAL_ENV" ]; then + virtualenv $VENV --always-copy + source $VENV/bin/activate + DEACTIVE=true +fi + +### install dependencies +pip install -r $REQUIREMENTS_FILE | tee -a $REQUIREMENTS_OUT + +### run tests +tox || exit 1 + +### static analysis of code +#flake8 --show-source petstore_api/ + +### deactivate virtualenv +#if [ $DEACTIVE == true ]; then +# deactivate +#fi diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/testfiles/pix.gif b/samples/openapi3/client/petstore/python-pydantic-v1/testfiles/pix.gif new file mode 100644 index 0000000000000000000000000000000000000000..f191b280ce91e6cb8c387735c10ef9bc5da6c83b GIT binary patch literal 42 ocmZ?wbhEHbWMp7uXkY+=|Ns9h{$ybUF?B!$NQQxl(S^Yp0J!f4_W%F@ literal 0 HcmV?d00001 diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/tests/__init__.py b/samples/openapi3/client/petstore/python-pydantic-v1/tests/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_api_client.py b/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_api_client.py new file mode 100644 index 000000000000..ee9afd740cd1 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_api_client.py @@ -0,0 +1,261 @@ +# coding: utf-8 + +# flake8: noqa + +""" +Run the tests. +$ pip install -U pytest +$ cd OpenAPIetstore-python +$ pytest +""" + +import os +import time +import atexit +import weakref +import unittest +from dateutil.parser import parse + +import petstore_api +import petstore_api.configuration + +HOST = 'http://localhost/v2' + + +class ApiClientTests(unittest.TestCase): + + def setUp(self): + self.api_client = petstore_api.ApiClient() + + def test_configuration(self): + config = petstore_api.Configuration() + + config.api_key['api_key'] = '123456' + config.api_key_prefix['api_key'] = 'PREFIX' + config.username = 'test_username' + config.password = 'test_password' + + header_params = {'test1': 'value1'} + query_params = {'test2': 'value2'} + auth_settings = ['api_key', 'unknown'] + + client = petstore_api.ApiClient(config) + + # test prefix + self.assertEqual('PREFIX', client.configuration.api_key_prefix['api_key']) + + # update parameters based on auth setting + client.update_params_for_auth(header_params, query_params, + auth_settings, + None, None, None) + + # test api key auth + self.assertEqual(header_params['test1'], 'value1') + self.assertEqual(header_params['api_key'], 'PREFIX 123456') + self.assertEqual(query_params['test2'], 'value2') + + # test basic auth + self.assertEqual('test_username', client.configuration.username) + self.assertEqual('test_password', client.configuration.password) + + def test_select_header_accept(self): + accepts = ['APPLICATION/JSON', 'APPLICATION/XML'] + accept = self.api_client.select_header_accept(accepts) + self.assertEqual(accept, 'APPLICATION/JSON') + + accepts = ['application/json', 'application/xml'] + accept = self.api_client.select_header_accept(accepts) + self.assertEqual(accept, 'application/json') + + accepts = ['application/xml', 'application/json'] + accept = self.api_client.select_header_accept(accepts) + self.assertEqual(accept, 'application/json') + + accepts = ['application/xml', 'application/json-patch+json'] + accept = self.api_client.select_header_accept(accepts) + self.assertEqual(accept, 'application/json-patch+json') + + accepts = ['application/xml', 'application/json; charset=utf-8'] + accept = self.api_client.select_header_accept(accepts) + self.assertEqual(accept, 'application/json; charset=utf-8') + + accepts = ['application/xml', 'application/json;format=flowed'] + accept = self.api_client.select_header_accept(accepts) + self.assertEqual(accept, 'application/json;format=flowed') + + accepts = ['text/plain', 'application/xml'] + accept = self.api_client.select_header_accept(accepts) + self.assertEqual(accept, 'text/plain') + + accepts = [] + accept = self.api_client.select_header_accept(accepts) + self.assertEqual(accept, None) + + def test_select_header_content_type(self): + content_types = ['APPLICATION/JSON', 'APPLICATION/XML'] + content_type = self.api_client.select_header_content_type(content_types) + self.assertEqual(content_type, 'APPLICATION/JSON') + + content_types = ['application/json', 'application/xml'] + content_type = self.api_client.select_header_content_type(content_types) + self.assertEqual(content_type, 'application/json') + + content_types = ['application/xml', 'application/json'] + content_type = self.api_client.select_header_content_type(content_types) + self.assertEqual(content_type, 'application/json') + + content_types = ['application/xml', 'application/json-patch+json'] + content_type = self.api_client.select_header_content_type(content_types) + self.assertEqual(content_type, 'application/json-patch+json') + + content_types = ['application/xml', 'application/json; charset=utf-8'] + content_type = self.api_client.select_header_content_type(content_types) + self.assertEqual(content_type, 'application/json; charset=utf-8') + + content_types = ['application/xml', 'application/json;format=flowed'] + content_type = self.api_client.select_header_content_type(content_types) + self.assertEqual(content_type, 'application/json;format=flowed') + + content_types = ['text/plain', 'application/xml'] + content_type = self.api_client.select_header_content_type(content_types) + self.assertEqual(content_type, 'text/plain') + + # no content type, default to None + content_types = [] + content_type = self.api_client.select_header_content_type(content_types) + self.assertEqual(content_type, None) + + def test_sanitize_for_serialization(self): + # None + data = None + result = self.api_client.sanitize_for_serialization(None) + self.assertEqual(result, data) + + # str + data = "test string" + result = self.api_client.sanitize_for_serialization(data) + self.assertEqual(result, data) + + # int + data = 1 + result = self.api_client.sanitize_for_serialization(data) + self.assertEqual(result, data) + + # bool + data = True + result = self.api_client.sanitize_for_serialization(data) + self.assertEqual(result, data) + + # date + data = parse("1997-07-16").date() # date + result = self.api_client.sanitize_for_serialization(data) + self.assertEqual(result, "1997-07-16") + + # datetime + data = parse("1997-07-16T19:20:30.45+01:00") # datetime + result = self.api_client.sanitize_for_serialization(data) + self.assertEqual(result, "1997-07-16T19:20:30.450000+01:00") + + # list + data = [1] + result = self.api_client.sanitize_for_serialization(data) + self.assertEqual(result, data) + + # dict + data = {"test key": "test value"} + result = self.api_client.sanitize_for_serialization(data) + self.assertEqual(result, data) + + # model + pet_dict = {"id": 1, "name": "monkey", + "category": {"id": 1, "name": "test category"}, + "tags": [{"id": 1, "name": "test tag1"}, + {"id": 2, "name": "test tag2"}], + "status": "available", + "photoUrls": ["http://foo.bar.com/3", + "http://foo.bar.com/4"]} + pet = petstore_api.Pet(name=pet_dict["name"], photo_urls=pet_dict["photoUrls"]) + pet.id = pet_dict["id"] + cate = petstore_api.Category(name="something") + cate.id = pet_dict["category"]["id"] + cate.name = pet_dict["category"]["name"] + pet.category = cate + tag1 = petstore_api.Tag() + tag1.id = pet_dict["tags"][0]["id"] + tag1.name = pet_dict["tags"][0]["name"] + tag2 = petstore_api.Tag() + tag2.id = pet_dict["tags"][1]["id"] + tag2.name = pet_dict["tags"][1]["name"] + pet.tags = [tag1, tag2] + pet.status = pet_dict["status"] + + data = pet + result = self.api_client.sanitize_for_serialization(data) + self.assertEqual(result, pet_dict) + + # list of models + list_of_pet_dict = [pet_dict] + data = [pet] + result = self.api_client.sanitize_for_serialization(data) + self.assertEqual(result, list_of_pet_dict) + + def test_context_manager_closes_threadpool(self): + with petstore_api.ApiClient() as client: + self.assertIsNotNone(client.pool) + pool_ref = weakref.ref(client._pool) + self.assertIsNotNone(pool_ref()) + self.assertIsNone(pool_ref()) + + def test_atexit_closes_threadpool(self): + client = petstore_api.ApiClient() + self.assertIsNotNone(client.pool) + self.assertIsNotNone(client._pool) + atexit._run_exitfuncs() + self.assertIsNone(client._pool) + + def test_parameters_to_url_query(self): + data = 'value={"category": "example", "category2": "example2"}' + dictionary = { + "category": "example", + "category2": "example2" + } + result = self.api_client.parameters_to_url_query([('value', dictionary)], {}) + self.assertEqual(result, "value=%7B%22category%22%3A%20%22example%22%2C%20%22category2%22%3A%20%22example2%22%7D") + + data='value={"number": 1, "string": "str", "bool": true, "dict": {"number": 1, "string": "str", "bool": true}}' + dictionary = { + "number": 1, + "string": "str", + "bool": True, + "dict": { + "number": 1, + "string": "str", + "bool": True + } + } + result = self.api_client.parameters_to_url_query([('value', dictionary)], {}) + self.assertEqual(result, 'value=%7B%22number%22%3A%201%2C%20%22string%22%3A%20%22str%22%2C%20%22bool%22%3A%20true%2C%20%22dict%22%3A%20%7B%22number%22%3A%201%2C%20%22string%22%3A%20%22str%22%2C%20%22bool%22%3A%20true%7D%7D') + + data='value={"strValues": ["one", "two", "three"], "dictValues": [{"name": "value1", "age": 14}, {"name": "value2", "age": 12}]}' + dictionary = { + "strValues": [ + "one", + "two", + "three" + ], + "dictValues": [ + { + "name": "value1", + "age": 14 + }, + { + "name": "value2", + "age": 12 + }, + ] + } + result = self.api_client.parameters_to_url_query([('value', dictionary)], {}) + self.assertEqual(result, 'value=%7B%22strValues%22%3A%20%5B%22one%22%2C%20%22two%22%2C%20%22three%22%5D%2C%20%22dictValues%22%3A%20%5B%7B%22name%22%3A%20%22value1%22%2C%20%22age%22%3A%2014%7D%2C%20%7B%22name%22%3A%20%22value2%22%2C%20%22age%22%3A%2012%7D%5D%7D') + + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_api_exception.py b/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_api_exception.py new file mode 100644 index 000000000000..73915b0d5fca --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_api_exception.py @@ -0,0 +1,82 @@ +# coding: utf-8 + +# flake8: noqa + +""" +Run the tests. +$ pip install -U pytest +$ cd petstore_api-python +$ pytest +""" + +import os +import six +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException + +from .util import id_gen + + +class ApiExceptionTests(unittest.TestCase): + + def setUp(self): + self.api_client = petstore_api.ApiClient() + self.pet_api = petstore_api.PetApi(self.api_client) + self.setUpModels() + + def setUpModels(self): + self.category = petstore_api.Category(name="dog") + self.category.id = id_gen() + self.category.name = "dog" + self.tag = petstore_api.Tag() + self.tag.id = id_gen() + self.tag.name = "blank" + self.pet = petstore_api.Pet(name="hello kity", photo_urls=["http://foo.bar.com/1", "http://foo.bar.com/2"]) + self.pet.id = id_gen() + self.pet.status = "sold" + self.pet.category = self.category + self.pet.tags = [self.tag] + + def test_404_error(self): + self.pet_api.add_pet(self.pet) + self.pet_api.delete_pet(pet_id=self.pet.id) + + with self.checkRaiseRegex(ApiException, "Pet not found"): + self.pet_api.get_pet_by_id(pet_id=self.pet.id) + + try: + self.pet_api.get_pet_by_id(pet_id=self.pet.id) + except ApiException as e: + self.assertEqual(e.status, 404) + self.assertEqual(e.reason, "Not Found") + self.checkRegex(e.body, "Pet not found") + + def test_500_error(self): + self.pet_api.add_pet(self.pet) + + with self.checkRaiseRegex(ApiException, "Internal Server Error"): + self.pet_api.upload_file( + pet_id=self.pet.id, + additional_metadata="special", + file=None + ) + + try: + self.pet_api.upload_file( + pet_id=self.pet.id, + additional_metadata="special", + file=None + ) + except ApiException as e: + self.assertEqual(e.status, 500) + self.assertEqual(e.reason, "Internal Server Error") + self.checkRegex(e.body, "Error 500 Internal Server Error") + + def checkRaiseRegex(self, expected_exception, expected_regex): + return self.assertRaisesRegex(expected_exception, expected_regex) + + def checkRegex(self, text, expected_regex): + return self.assertRegex(text, expected_regex) diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_api_validation.py b/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_api_validation.py new file mode 100644 index 000000000000..dc7da96329c0 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_api_validation.py @@ -0,0 +1,79 @@ +# coding: utf-8 + +# flake8: noqa + +""" +Run the tests. +$ pip install -U pytest +$ cd petstore_api-python +$ pytest +""" + +import os +import six +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from pydantic import BaseModel, ValidationError + +from .util import id_gen + + +class ApiExceptionTests(unittest.TestCase): + + def setUp(self): + self.api_client = petstore_api.ApiClient() + self.pet_api = petstore_api.PetApi(self.api_client) + self.setUpModels() + + def setUpModels(self): + self.category = petstore_api.Category(name="dog") + self.category.id = id_gen() + self.category.name = "dog" + self.tag = petstore_api.Tag() + self.tag.id = id_gen() + self.tag.name = "blank" + self.pet = petstore_api.Pet(name="hello kity", photo_urls=["http://foo.bar.com/1", "http://foo.bar.com/2"]) + self.pet.id = id_gen() + self.pet.status = "sold" + self.pet.category = self.category + self.pet.tags = [self.tag] + + def test_set_param_validation(self): + try: + self.pet_api.find_pets_by_tags(["a", "a"]) + except ValidationError as e: + self.assertTrue("the list has duplicated items" in str(e)) + + def test_required_param_validation(self): + try: + self.pet_api.get_pet_by_id() + except ValidationError as e: + self.assertEqual(str(e), "1 validation error for GetPetById\n" + "pet_id\n" + " field required (type=value_error.missing)") + + def test_integer_validation(self): + try: + self.pet_api.get_pet_by_id("123") + except ValidationError as e: + self.assertEqual(str(e), "1 validation error for GetPetById\n" + "pet_id\n" + " value is not a valid integer (type=type_error.integer)") + + def test_string_enum_validation(self): + try: + self.pet_api.find_pets_by_status(["Cat"]) + except ValidationError as e: + self.assertEqual(str(e), "1 validation error for FindPetsByStatus\n" + "status -> 0\n" + " unexpected value; permitted: 'available', 'pending', 'sold' (" + "type=value_error.const; given=Cat; permitted=('available', 'pending', 'sold'))") + + def checkRaiseRegex(self, expected_exception, expected_regex): + return self.assertRaisesRegex(expected_exception, expected_regex) + + def checkRegex(self, text, expected_regex): + return self.assertRegex(text, expected_regex) diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_configuration.py b/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_configuration.py new file mode 100644 index 000000000000..04c2781f5e29 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_configuration.py @@ -0,0 +1,62 @@ +# coding: utf-8 + +# flake8: noqa + +""" +Run the tests. +$ pip install -U pytest +$ cd petstore_api-python +$ pytest +""" +from __future__ import absolute_import + +import unittest + +import petstore_api + + +class TestConfiguration(unittest.TestCase): + """Animal unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + # reset Configuration + petstore_api.Configuration.set_default(None) + + def testConfiguration(self): + # check that different instances use different dictionaries + c1 = petstore_api.Configuration() + c2 = petstore_api.Configuration() + self.assertNotEqual(id(c1), id(c2)) + self.assertNotEqual(id(c1.api_key), id(c2.api_key)) + self.assertNotEqual(id(c1.api_key_prefix), id(c2.api_key_prefix)) + + def testDefaultConfiguration(self): + # prepare default configuration + c1 = petstore_api.Configuration(host="example.com") + c1.debug = True + petstore_api.Configuration.set_default(c1) + + # get default configuration + c2 = petstore_api.Configuration.get_default_copy() + self.assertEqual(c2.host, "example.com") + self.assertTrue(c2.debug) + + self.assertEqual(id(c1), id(c2)) + self.assertEqual(id(c1.api_key), id(c2.api_key)) + self.assertEqual(id(c1.api_key_prefix), id(c2.api_key_prefix)) + + def testApiClientDefaultConfiguration(self): + # ensure the default configuration is the same + p1 = petstore_api.PetApi() + p2 = petstore_api.PetApi() + self.assertEqual(id(p1.api_client.configuration), id(p2.api_client.configuration)) + + def testAccessTokenWhenConstructingConfiguration(self): + c1 = petstore_api.Configuration(access_token="12345") + self.assertEqual(c1.access_token, "12345") + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_deserialization.py b/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_deserialization.py new file mode 100644 index 000000000000..c5fb68663821 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_deserialization.py @@ -0,0 +1,295 @@ +# coding: utf-8 + +# flake8: noqa + +""" +Run the tests. +$ pip install -U pytest +$ cd OpenAPIPetstore-python +$ pytest +""" +from collections import namedtuple +import json +import os +import time +import unittest +import datetime + +import pytest as pytest + +import petstore_api + +MockResponse = namedtuple('MockResponse', 'data') + + +class DeserializationTests(unittest.TestCase): + + def setUp(self): + self.api_client = petstore_api.ApiClient() + self.deserialize = self.api_client.deserialize + + def test_enum_test(self): + """ deserialize Dict[str, EnumTest] """ + data = { + 'enum_test': { + "enum_string": "UPPER", + "enum_string_required": "lower", + "enum_integer": 1, + "enum_number": 1.1, + "outerEnum": "placed" + } + } + response = MockResponse(data=json.dumps(data)) + + deserialized = self.deserialize(response, 'Dict[str, EnumTest]') + self.assertTrue(isinstance(deserialized, dict)) + self.assertTrue(isinstance(deserialized['enum_test'], petstore_api.EnumTest)) + self.assertEqual(deserialized['enum_test'], + petstore_api.EnumTest(enum_string="UPPER", + enum_string_required="lower", + enum_integer=1, + enum_number=1.1, + outer_enum=petstore_api.OuterEnum.PLACED)) + + def test_deserialize_dict_str_pet(self): + """ deserialize Dict[str, Pet] """ + data = { + 'pet': { + "id": 0, + "category": { + "id": 0, + "name": "string" + }, + "name": "doggie", + "photoUrls": [ + "string" + ], + "tags": [ + { + "id": 0, + "name": "string" + } + ], + "status": "available" + } + } + response = MockResponse(data=json.dumps(data)) + + deserialized = self.deserialize(response, 'Dict[str, Pet]') + self.assertTrue(isinstance(deserialized, dict)) + self.assertTrue(isinstance(deserialized['pet'], petstore_api.Pet)) + + @pytest.mark.skip(reason="skipping for now as deserialization will be refactored") + def test_deserialize_dict_str_dog(self): + """ deserialize Dict[str, Animal], use discriminator""" + data = { + 'dog': { + "id": 0, + "className": "Dog", + "color": "white", + "bread": "Jack Russel Terrier" + } + } + response = MockResponse(data=json.dumps(data)) + + deserialized = self.deserialize(response, 'Dict[str, Animal]') + self.assertTrue(isinstance(deserialized, dict)) + self.assertTrue(isinstance(deserialized['dog'], petstore_api.Dog)) + + @pytest.mark.skip(reason="skipping for now as deserialization will be refactored") + def test_deserialize_dict_str_int(self): + """ deserialize Dict[str, int] """ + data = { + 'integer': 1 + } + response = MockResponse(data=json.dumps(data)) + + deserialized = self.deserialize(response, 'Dict[str, int]') + self.assertTrue(isinstance(deserialized, dict)) + self.assertTrue(isinstance(deserialized['integer'], int)) + + def test_deserialize_str(self): + """ deserialize str """ + data = "test str" + response = MockResponse(data=json.dumps(data)) + + deserialized = self.deserialize(response, "str") + self.assertTrue(isinstance(deserialized, str)) + + def test_deserialize_date(self): + """ deserialize date """ + data = "1997-07-16" + response = MockResponse(data=json.dumps(data)) + + deserialized = self.deserialize(response, "date") + self.assertTrue(isinstance(deserialized, datetime.date)) + + def test_deserialize_datetime(self): + """ deserialize datetime """ + data = "1997-07-16T19:20:30.45+01:00" + response = MockResponse(data=json.dumps(data)) + + deserialized = self.deserialize(response, "datetime") + self.assertTrue(isinstance(deserialized, datetime.datetime)) + + def test_deserialize_pet(self): + """ deserialize pet """ + data = { + "id": 0, + "category": { + "id": 0, + "name": "string" + }, + "name": "doggie", + "photoUrls": [ + "string" + ], + "tags": [ + { + "id": 0, + "name": "string" + } + ], + "status": "available" + } + response = MockResponse(data=json.dumps(data)) + + deserialized = self.deserialize(response, "Pet") + self.assertTrue(isinstance(deserialized, petstore_api.Pet)) + self.assertEqual(deserialized.id, 0) + self.assertEqual(deserialized.name, "doggie") + self.assertTrue(isinstance(deserialized.category, petstore_api.Category)) + self.assertEqual(deserialized.category.name, "string") + self.assertTrue(isinstance(deserialized.tags, list)) + self.assertEqual(deserialized.tags[0].name, "string") + + def test_deserialize_list_of_pet(self): + """ deserialize list[Pet] """ + data = [ + { + "id": 0, + "category": { + "id": 0, + "name": "string" + }, + "name": "doggie0", + "photoUrls": [ + "string" + ], + "tags": [ + { + "id": 0, + "name": "string" + } + ], + "status": "available" + }, + { + "id": 1, + "category": { + "id": 0, + "name": "string" + }, + "name": "doggie1", + "photoUrls": [ + "string" + ], + "tags": [ + { + "id": 0, + "name": "string" + } + ], + "status": "available" + }] + response = MockResponse(data=json.dumps(data)) + + deserialized = self.deserialize(response, "List[Pet]") + self.assertTrue(isinstance(deserialized, list)) + self.assertTrue(isinstance(deserialized[0], petstore_api.Pet)) + self.assertEqual(deserialized[0].id, 0) + self.assertEqual(deserialized[1].id, 1) + self.assertEqual(deserialized[0].name, "doggie0") + self.assertEqual(deserialized[1].name, "doggie1") + + def test_deserialize_nested_dict(self): + """ deserialize Dict[str, Dict[str, int]] """ + data = { + "foo": { + "bar": 1 + } + } + response = MockResponse(data=json.dumps(data)) + + deserialized = self.deserialize(response, "Dict[str, Dict[str, int]]") + self.assertTrue(isinstance(deserialized, dict)) + self.assertTrue(isinstance(deserialized["foo"], dict)) + self.assertTrue(isinstance(deserialized["foo"]["bar"], int)) + + def test_deserialize_nested_list(self): + """ deserialize list[list[str]] """ + data = [["foo"]] + response = MockResponse(data=json.dumps(data)) + + deserialized = self.deserialize(response, "List[List[str]]") + self.assertTrue(isinstance(deserialized, list)) + self.assertTrue(isinstance(deserialized[0], list)) + self.assertTrue(isinstance(deserialized[0][0], str)) + + def test_deserialize_none(self): + """ deserialize None """ + response = MockResponse(data=json.dumps(None)) + + deserialized = self.deserialize(response, "datetime") + self.assertIsNone(deserialized) + + def test_deserialize_pig(self): + """ deserialize pig (oneOf) """ + data = { + "className": "BasqueBig", + "color": "white" + } + + response = MockResponse(data=json.dumps(data)) + deserialized = self.deserialize(response, "Pig") + self.assertTrue(isinstance(deserialized.actual_instance, + petstore_api.BasquePig)) + self.assertEqual(deserialized.actual_instance.class_name, "BasqueBig") + self.assertEqual(deserialized.actual_instance.color, "white") + + def test_deserialize_animal(self): + """ deserialize animal with discriminator mapping """ + data = { + "declawed": True, + "className": "Cat2222" # incorrect class name + } + + response = MockResponse(data=json.dumps(data)) + + with pytest.raises(ValueError) as ex: + deserialized = self.deserialize(response, "Animal") + assert str( + ex.value) == 'Animal failed to lookup discriminator value from {"declawed": true, "className": ' \ + '"Cat2222"}. Discriminator property name: className, mapping: {"Cat": "Cat", "Dog": "Dog"}' + + data = { + "declawed": True, + "className": "Cat" # correct class name + } + + response = MockResponse(data=json.dumps(data)) + + deserialized = self.deserialize(response, "Animal") + self.assertTrue(isinstance(deserialized, petstore_api.Cat)) + self.assertEqual(deserialized.class_name, "Cat") + self.assertEqual(deserialized.declawed, True) + self.assertEqual(deserialized.to_json(), '{"className": "Cat", "color": "red", "declawed": true}') + + # test from json + json_str = '{"className": "Cat", "color": "red", "declawed": true}' + + deserialized = petstore_api.Animal.from_json(json_str) + self.assertTrue(isinstance(deserialized, petstore_api.Cat)) + self.assertEqual(deserialized.class_name, "Cat") + self.assertEqual(deserialized.declawed, True) + self.assertEqual(deserialized.to_json(), '{"className": "Cat", "color": "red", "declawed": true}') diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_http_signature.py b/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_http_signature.py new file mode 100644 index 000000000000..2784d3ac1d0b --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_http_signature.py @@ -0,0 +1,521 @@ +# coding: utf-8 + +# flake8: noqa + +""" +Run the tests. +$ docker pull swaggerapi/petstore +$ docker run -d -e SWAGGER_HOST=http://petstore.swagger.io -e SWAGGER_BASE_PATH=/v2 -p 80:8080 swaggerapi/petstore +$ cd petstore_api-python +$ pytest +""" + +from collections import namedtuple +from datetime import datetime, timedelta +import base64 +import json +import os +import re +import shutil +import unittest +from urllib.parse import urlencode, urlparse + +from Crypto.Hash import SHA256, SHA512 +from Crypto.PublicKey import ECC, RSA +from Crypto.Signature import pkcs1_15, pss, DSS + +import petstore_api +#from petstore_api.models import Category, Tag, Pet +from petstore_api.api.pet_api import PetApi +from petstore_api import Configuration, signing +from petstore_api.rest import ( + RESTClientObject, + RESTResponse +) + +from petstore_api.exceptions import ( + ApiException, + ApiValueError, + ApiTypeError, +) + +from .util import id_gen + +import urllib3 + +from unittest.mock import patch + +HOST = 'http://localhost/v2' + +# This test RSA private key below is published in Appendix C 'Test Values' of +# https://www.ietf.org/id/draft-cavage-http-signatures-12.txt +RSA_TEST_PRIVATE_KEY = """-----BEGIN RSA PRIVATE KEY----- +MIICXgIBAAKBgQDCFENGw33yGihy92pDjZQhl0C36rPJj+CvfSC8+q28hxA161QF +NUd13wuCTUcq0Qd2qsBe/2hFyc2DCJJg0h1L78+6Z4UMR7EOcpfdUE9Hf3m/hs+F +UR45uBJeDK1HSFHD8bHKD6kv8FPGfJTotc+2xjJwoYi+1hqp1fIekaxsyQIDAQAB +AoGBAJR8ZkCUvx5kzv+utdl7T5MnordT1TvoXXJGXK7ZZ+UuvMNUCdN2QPc4sBiA +QWvLw1cSKt5DsKZ8UETpYPy8pPYnnDEz2dDYiaew9+xEpubyeW2oH4Zx71wqBtOK +kqwrXa/pzdpiucRRjk6vE6YY7EBBs/g7uanVpGibOVAEsqH1AkEA7DkjVH28WDUg +f1nqvfn2Kj6CT7nIcE3jGJsZZ7zlZmBmHFDONMLUrXR/Zm3pR5m0tCmBqa5RK95u +412jt1dPIwJBANJT3v8pnkth48bQo/fKel6uEYyboRtA5/uHuHkZ6FQF7OUkGogc +mSJluOdc5t6hI1VsLn0QZEjQZMEOWr+wKSMCQQCC4kXJEsHAve77oP6HtG/IiEn7 +kpyUXRNvFsDE0czpJJBvL/aRFUJxuRK91jhjC68sA7NsKMGg5OXb5I5Jj36xAkEA +gIT7aFOYBFwGgQAQkWNKLvySgKbAZRTeLBacpHMuQdl1DfdntvAyqpAZ0lY0RKmW +G6aFKaqQfOXKCyWoUiVknQJAXrlgySFci/2ueKlIE1QqIiLSZ8V8OlpFLRnb1pzI +7U1yQXnTAEFYM560yJlzUpOb1V4cScGd365tiSMvxLOvTA== +-----END RSA PRIVATE KEY-----""" + + +class TimeoutWithEqual(urllib3.Timeout): + def __init__(self, *arg, **kwargs): + super(TimeoutWithEqual, self).__init__(*arg, **kwargs) + + def __eq__(self, other): + return self._read == other._read and self._connect == other._connect and self.total == other.total + +class MockPoolManager(object): + def __init__(self, tc): + self._tc = tc + self._reqs = [] + + def expect_request(self, *args, **kwargs): + self._reqs.append((args, kwargs)) + + def set_signing_config(self, signing_cfg): + self.signing_cfg = signing_cfg + self._tc.assertIsNotNone(self.signing_cfg) + self.pubkey = self.signing_cfg.get_public_key() + self._tc.assertIsNotNone(self.pubkey) + + def request(self, *actual_request_target, **actual_request_headers_and_body): + self._tc.assertTrue(len(self._reqs) > 0) + expected_results = self._reqs.pop(0) + self._tc.maxDiff = None + expected_request_target = expected_results[0] # The expected HTTP method and URL path. + expected_request_headers_and_body = expected_results[1] # dict that contains the expected body, headers + self._tc.assertEqual(expected_request_target, actual_request_target) + # actual_request_headers_and_body is a dict that contains the actual body, headers + for k, expected in expected_request_headers_and_body.items(): + self._tc.assertIn(k, actual_request_headers_and_body) + if k == 'body': + actual_body = actual_request_headers_and_body[k] + self._tc.assertEqual(expected, actual_body) + elif k == 'headers': + actual_headers = actual_request_headers_and_body[k] + for expected_header_name, expected_header_value in expected.items(): + # Validate the generated request contains the expected header. + self._tc.assertIn(expected_header_name, actual_headers) + actual_header_value = actual_headers[expected_header_name] + # Compare the actual value of the header against the expected value. + pattern = re.compile(expected_header_value) + m = pattern.match(actual_header_value) + self._tc.assertTrue(m, msg="Expected:\n{0}\nActual:\n{1}".format( + expected_header_value,actual_header_value)) + if expected_header_name == 'Authorization': + self._validate_authorization_header( + expected_request_target, actual_headers, actual_header_value) + elif k == 'timeout': + self._tc.assertEqual(expected, actual_request_headers_and_body[k]) + return urllib3.HTTPResponse(status=200, body=b'test') + + def _validate_authorization_header(self, request_target, actual_headers, authorization_header): + """Validate the signature. + """ + # Extract (created) + r1 = re.compile(r'created=([0-9]+)') + m1 = r1.search(authorization_header) + self._tc.assertIsNotNone(m1) + created = m1.group(1) + + # Extract list of signed headers + r1 = re.compile(r'headers="([^"]+)"') + m1 = r1.search(authorization_header) + self._tc.assertIsNotNone(m1) + headers = m1.group(1).split(' ') + signed_headers_list = [] + for h in headers: + if h == '(created)': + signed_headers_list.append((h, created)) + elif h == '(request-target)': + url = request_target[1] + target_path = urlparse(url).path + signed_headers_list.append((h, "{0} {1}".format(request_target[0].lower(), target_path))) + else: + value = next((v for k, v in actual_headers.items() if k.lower() == h), None) + self._tc.assertIsNotNone(value) + signed_headers_list.append((h, value)) + header_items = [ + "{0}: {1}".format(key.lower(), value) for key, value in signed_headers_list] + string_to_sign = "\n".join(header_items) + digest = None + if self.signing_cfg.hash_algorithm == signing.HASH_SHA512: + digest = SHA512.new() + elif self.signing_cfg.hash_algorithm == signing.HASH_SHA256: + digest = SHA256.new() + else: + self._tc.fail("Unsupported hash algorithm: {0}".format(self.signing_cfg.hash_algorithm)) + digest.update(string_to_sign.encode()) + b64_body_digest = base64.b64encode(digest.digest()).decode() + + # Extract the signature + r2 = re.compile(r'signature="([^"]+)"') + m2 = r2.search(authorization_header) + self._tc.assertIsNotNone(m2) + b64_signature = m2.group(1) + signature = base64.b64decode(b64_signature) + # Build the message + signing_alg = self.signing_cfg.signing_algorithm + if signing_alg is None: + # Determine default + if isinstance(self.pubkey, RSA.RsaKey): + signing_alg = signing.ALGORITHM_RSASSA_PSS + elif isinstance(self.pubkey, ECC.EccKey): + signing_alg = signing.ALGORITHM_ECDSA_MODE_FIPS_186_3 + else: + self._tc.fail("Unsupported key: {0}".format(type(self.pubkey))) + + if signing_alg == signing.ALGORITHM_RSASSA_PKCS1v15: + pkcs1_15.new(self.pubkey).verify(digest, signature) + elif signing_alg == signing.ALGORITHM_RSASSA_PSS: + pss.new(self.pubkey).verify(digest, signature) + elif signing_alg == signing.ALGORITHM_ECDSA_MODE_FIPS_186_3: + verifier = DSS.new(key=self.pubkey, mode=signing.ALGORITHM_ECDSA_MODE_FIPS_186_3, + encoding='der') + verifier.verify(digest, signature) + elif signing_alg == signing.ALGORITHM_ECDSA_MODE_DETERMINISTIC_RFC6979: + verifier = DSS.new(key=self.pubkey, mode=signing.ALGORITHM_ECDSA_MODE_DETERMINISTIC_RFC6979, + encoding='der') + verifier.verify(digest, signature) + else: + self._tc.fail("Unsupported signing algorithm: {0}".format(signing_alg)) + +class PetApiTests(unittest.TestCase): + + @classmethod + def setUpClass(cls): + cls.setUpModels() + cls.setUpFiles() + + @classmethod + def tearDownClass(cls): + file_paths = [ + cls.rsa_key_path, + cls.rsa4096_key_path, + cls.ec_p521_key_path, + ] + for file_path in file_paths: + os.unlink(file_path) + + @classmethod + def setUpModels(cls): + cls.category = petstore_api.Category(name="dog") + cls.category.id = id_gen() + cls.tag = petstore_api.Tag() + cls.tag.id = id_gen() + cls.tag.name = "python-pet-tag" + cls.pet = petstore_api.Pet( + name="hello kity", + photo_urls=["http://foo.bar.com/1", "http://foo.bar.com/2"] + ) + cls.pet.id = id_gen() + cls.pet.status = "sold" + cls.pet.category = cls.category + cls.pet.tags = [cls.tag] + + @classmethod + def setUpFiles(cls): + cls.test_file_dir = os.path.join( + os.path.dirname(__file__), "..", "testfiles") + cls.test_file_dir = os.path.realpath(cls.test_file_dir) + if not os.path.exists(cls.test_file_dir): + os.mkdir(cls.test_file_dir) + + cls.private_key_passphrase = 'test-passphrase' + cls.rsa_key_path = os.path.join(cls.test_file_dir, 'rsa.pem') + cls.rsa4096_key_path = os.path.join(cls.test_file_dir, 'rsa4096.pem') + cls.ec_p521_key_path = os.path.join(cls.test_file_dir, 'ecP521.pem') + + if not os.path.exists(cls.rsa_key_path): + with open(cls.rsa_key_path, 'w') as f: + f.write(RSA_TEST_PRIVATE_KEY) + + if not os.path.exists(cls.rsa4096_key_path): + key = RSA.generate(4096) + private_key = key.export_key( + passphrase=cls.private_key_passphrase, + protection='PEM' + ) + with open(cls.rsa4096_key_path, "wb") as f: + f.write(private_key) + + if not os.path.exists(cls.ec_p521_key_path): + key = ECC.generate(curve='P-521') + private_key = key.export_key( + format='PEM', + passphrase=cls.private_key_passphrase, + use_pkcs8=True, + protection='PBKDF2WithHMAC-SHA1AndAES128-CBC' + ) + with open(cls.ec_p521_key_path, "wt") as f: + f.write(private_key) + + def test_valid_http_signature(self): + privkey_path = self.rsa_key_path + signing_cfg = signing.HttpSigningConfiguration( + key_id="my-key-id", + signing_scheme=signing.SCHEME_HS2019, + private_key_path=privkey_path, + private_key_passphrase=self.private_key_passphrase, + signing_algorithm=signing.ALGORITHM_RSASSA_PKCS1v15, + signed_headers=[ + signing.HEADER_REQUEST_TARGET, + signing.HEADER_CREATED, + signing.HEADER_HOST, + signing.HEADER_DATE, + signing.HEADER_DIGEST, + 'Content-Type' + ] + ) + config = Configuration(host=HOST, signing_info=signing_cfg) + # Set the OAuth2 access_token to None. Here we are interested in testing + # the HTTP signature scheme. + config.access_token = None + + api_client = petstore_api.ApiClient(config) + pet_api = PetApi(api_client) + + mock_pool = MockPoolManager(self) + api_client.rest_client.pool_manager = mock_pool + + mock_pool.set_signing_config(signing_cfg) + mock_pool.expect_request('POST', HOST + '/pet', + #body=json.dumps(api_client.sanitize_for_serialization(self.pet)), + body=self.pet.to_json(), + headers={'Content-Type': r'application/json', + 'Authorization': r'Signature keyId="my-key-id",algorithm="hs2019",created=[0-9]+,' + r'headers="\(request-target\) \(created\) host date digest content-type",' + r'signature="[a-zA-Z0-9+/=]+"', + 'User-Agent': r'OpenAPI-Generator/1.0.0/python'}, + preload_content=True, timeout=None) + + pet_api.add_pet(self.pet) + + def test_valid_http_signature_with_defaults(self): + privkey_path = self.rsa4096_key_path + signing_cfg = signing.HttpSigningConfiguration( + key_id="my-key-id", + signing_scheme=signing.SCHEME_HS2019, + private_key_path=privkey_path, + private_key_passphrase=self.private_key_passphrase, + ) + config = Configuration(host=HOST, signing_info=signing_cfg) + # Set the OAuth2 access_token to None. Here we are interested in testing + # the HTTP signature scheme. + config.access_token = None + + api_client = petstore_api.ApiClient(config) + pet_api = PetApi(api_client) + + mock_pool = MockPoolManager(self) + api_client.rest_client.pool_manager = mock_pool + + mock_pool.set_signing_config(signing_cfg) + mock_pool.expect_request('POST', HOST + '/pet', + #body=json.dumps(api_client.sanitize_for_serialization(self.pet)), + body=self.pet.to_json(), + headers={'Content-Type': r'application/json', + 'Authorization': r'Signature keyId="my-key-id",algorithm="hs2019",created=[0-9]+,' + r'headers="\(created\)",' + r'signature="[a-zA-Z0-9+/=]+"', + 'User-Agent': r'OpenAPI-Generator/1.0.0/python'}, + preload_content=True, timeout=None) + + pet_api.add_pet(self.pet) + + def test_valid_http_signature_rsassa_pkcs1v15(self): + privkey_path = self.rsa4096_key_path + signing_cfg = signing.HttpSigningConfiguration( + key_id="my-key-id", + signing_scheme=signing.SCHEME_HS2019, + private_key_path=privkey_path, + private_key_passphrase=self.private_key_passphrase, + signing_algorithm=signing.ALGORITHM_RSASSA_PKCS1v15, + signed_headers=[ + signing.HEADER_REQUEST_TARGET, + signing.HEADER_CREATED, + ] + ) + config = Configuration(host=HOST, signing_info=signing_cfg) + # Set the OAuth2 access_token to None. Here we are interested in testing + # the HTTP signature scheme. + config.access_token = None + + api_client = petstore_api.ApiClient(config) + pet_api = PetApi(api_client) + + mock_pool = MockPoolManager(self) + api_client.rest_client.pool_manager = mock_pool + + mock_pool.set_signing_config(signing_cfg) + mock_pool.expect_request('POST', HOST + '/pet', + #body=json.dumps(api_client.sanitize_for_serialization(self.pet)), + body=self.pet.to_json(), + headers={'Content-Type': r'application/json', + 'Authorization': r'Signature keyId="my-key-id",algorithm="hs2019",created=[0-9]+,' + r'headers="\(request-target\) \(created\)",' + r'signature="[a-zA-Z0-9+/=]+"', + 'User-Agent': r'OpenAPI-Generator/1.0.0/python'}, + preload_content=True, timeout=None) + + pet_api.add_pet(self.pet) + + def test_valid_http_signature_rsassa_pss(self): + privkey_path = self.rsa4096_key_path + signing_cfg = signing.HttpSigningConfiguration( + key_id="my-key-id", + signing_scheme=signing.SCHEME_HS2019, + private_key_path=privkey_path, + private_key_passphrase=self.private_key_passphrase, + signing_algorithm=signing.ALGORITHM_RSASSA_PSS, + signed_headers=[ + signing.HEADER_REQUEST_TARGET, + signing.HEADER_CREATED, + ] + ) + config = Configuration(host=HOST, signing_info=signing_cfg) + # Set the OAuth2 access_token to None. Here we are interested in testing + # the HTTP signature scheme. + config.access_token = None + + api_client = petstore_api.ApiClient(config) + pet_api = PetApi(api_client) + + mock_pool = MockPoolManager(self) + api_client.rest_client.pool_manager = mock_pool + + mock_pool.set_signing_config(signing_cfg) + mock_pool.expect_request('POST', HOST + '/pet', + #body=json.dumps(api_client.sanitize_for_serialization(self.pet)), + body=self.pet.to_json(), + headers={'Content-Type': r'application/json', + 'Authorization': r'Signature keyId="my-key-id",algorithm="hs2019",created=[0-9]+,' + r'headers="\(request-target\) \(created\)",' + r'signature="[a-zA-Z0-9+/=]+"', + 'User-Agent': r'OpenAPI-Generator/1.0.0/python'}, + preload_content=True, timeout=None) + + pet_api.add_pet(self.pet) + + def test_valid_http_signature_ec_p521(self): + privkey_path = self.ec_p521_key_path + signing_cfg = signing.HttpSigningConfiguration( + key_id="my-key-id", + signing_scheme=signing.SCHEME_HS2019, + private_key_path=privkey_path, + private_key_passphrase=self.private_key_passphrase, + hash_algorithm=signing.HASH_SHA512, + signed_headers=[ + signing.HEADER_REQUEST_TARGET, + signing.HEADER_CREATED, + ] + ) + config = Configuration(host=HOST, signing_info=signing_cfg) + # Set the OAuth2 access_token to None. Here we are interested in testing + # the HTTP signature scheme. + config.access_token = None + + api_client = petstore_api.ApiClient(config) + pet_api = PetApi(api_client) + + mock_pool = MockPoolManager(self) + api_client.rest_client.pool_manager = mock_pool + + mock_pool.set_signing_config(signing_cfg) + mock_pool.expect_request('POST', HOST + '/pet', + #body=json.dumps(api_client.sanitize_for_serialization(self.pet)), + body=self.pet.to_json(), + headers={'Content-Type': r'application/json', + 'Authorization': r'Signature keyId="my-key-id",algorithm="hs2019",created=[0-9]+,' + r'headers="\(request-target\) \(created\)",' + r'signature="[a-zA-Z0-9+/=]+"', + 'User-Agent': r'OpenAPI-Generator/1.0.0/python'}, + preload_content=True, timeout=None) + + pet_api.add_pet(self.pet) + + def test_invalid_configuration(self): + # Signing scheme must be valid. + with self.assertRaises(Exception) as cm: + signing_cfg = signing.HttpSigningConfiguration( + key_id="my-key-id", + signing_scheme='foo', + private_key_path=self.ec_p521_key_path + ) + self.assertTrue(re.match('Unsupported security scheme', str(cm.exception)), + 'Exception message: {0}'.format(str(cm.exception))) + + # Signing scheme must be specified. + with self.assertRaises(Exception) as cm: + signing_cfg = signing.HttpSigningConfiguration( + key_id="my-key-id", + private_key_path=self.ec_p521_key_path, + signing_scheme=None + ) + self.assertTrue(re.match('Unsupported security scheme', str(cm.exception)), + 'Exception message: {0}'.format(str(cm.exception))) + + # Private key passphrase is missing but key is encrypted. + with self.assertRaises(Exception) as cm: + signing_cfg = signing.HttpSigningConfiguration( + key_id="my-key-id", + signing_scheme=signing.SCHEME_HS2019, + private_key_path=self.ec_p521_key_path, + ) + self.assertTrue(re.match('Not a valid clear PKCS#8 structure', str(cm.exception)), + 'Exception message: {0}'.format(str(cm.exception))) + + # File containing private key must exist. + with self.assertRaises(Exception) as cm: + signing_cfg = signing.HttpSigningConfiguration( + key_id="my-key-id", + signing_scheme=signing.SCHEME_HS2019, + private_key_path='foobar', + ) + self.assertTrue(re.match('Private key file does not exist', str(cm.exception)), + 'Exception message: {0}'.format(str(cm.exception))) + + # The max validity must be a positive value. + with self.assertRaises(Exception) as cm: + signing_cfg = signing.HttpSigningConfiguration( + key_id="my-key-id", + signing_scheme=signing.SCHEME_HS2019, + private_key_path=self.ec_p521_key_path, + signature_max_validity=timedelta(hours=-1) + ) + self.assertTrue(re.match('The signature max validity must be a positive value', + str(cm.exception)), + 'Exception message: {0}'.format(str(cm.exception))) + + # Cannot include the 'Authorization' header. + with self.assertRaises(Exception) as cm: + signing_cfg = signing.HttpSigningConfiguration( + key_id="my-key-id", + signing_scheme=signing.SCHEME_HS2019, + private_key_path=self.ec_p521_key_path, + signed_headers=['Authorization'] + ) + self.assertTrue(re.match("'Authorization' header cannot be included", str(cm.exception)), + 'Exception message: {0}'.format(str(cm.exception))) + + # Cannot specify duplicate headers. + with self.assertRaises(Exception) as cm: + signing_cfg = signing.HttpSigningConfiguration( + key_id="my-key-id", + signing_scheme=signing.SCHEME_HS2019, + private_key_path=self.ec_p521_key_path, + signed_headers=['Host', 'Date', 'Host'] + ) + self.assertTrue(re.match('Cannot have duplicates in the signed_headers parameter', + str(cm.exception)), + 'Exception message: {0}'.format(str(cm.exception))) + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_map_test.py b/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_map_test.py new file mode 100644 index 000000000000..8c0cb48f432c --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_map_test.py @@ -0,0 +1,117 @@ +# coding: utf-8 + +# flake8: noqa + +""" +Run the tests. +$ pip install -U pytest +$ cd petstore_api-python +$ pytest +""" + +import os +import time +import unittest + +import petstore_api + + +class MapTestTests(unittest.TestCase): + + def test_maptest_init(self): + # + # Test MapTest construction with valid values + # + up_or_low_dict = { + 'UPPER': "UP", + 'lower': "low" + } +# map_enum_test = petstore_api.MapTest(map_of_enum_string=up_or_low_dict) +# +# self.assertEqual(map_enum_test.map_of_enum_string, up_or_low_dict) +# +# map_of_map_of_strings = { +# 'val1': 1, +# 'valText': "Text", +# 'valueDict': up_or_low_dict +# } +# map_enum_test = petstore_api.MapTest(map_map_of_string=map_of_map_of_strings) +# +# self.assertEqual(map_enum_test.map_map_of_string, map_of_map_of_strings) +# +# # +# # Make sure that the init fails for invalid enum values +# # +# black_or_white_dict = { +# 'black': "UP", +# 'white': "low" +# } +# try: +# map_enum_test = petstore_api.MapTest(map_of_enum_string=black_or_white_dict) +# self.assertTrue(0) +# except ValueError: +# self.assertTrue(1) +# +# def test_maptest_setter(self): +# # +# # Check with some valid values +# # +# map_enum_test = petstore_api.MapTest() +# up_or_low_dict = { +# 'UPPER': "UP", +# 'lower': "low" +# } +# map_enum_test.map_of_enum_string = up_or_low_dict +# self.assertEqual(map_enum_test.map_of_enum_string, up_or_low_dict) +# +# # +# # Check if the setter fails for invalid enum values +# # +# map_enum_test = petstore_api.MapTest() +# black_or_white_dict = { +# 'black': "UP", +# 'white': "low" +# } +# try: +# map_enum_test.map_of_enum_string = black_or_white_dict +# except ValueError: +# self.assertEqual(map_enum_test.map_of_enum_string, None) +# +# def test_todict(self): +# # +# # Check dictionary serialization +# # +# map_enum_test = petstore_api.MapTest() +# up_or_low_dict = { +# 'UPPER': "UP", +# 'lower': "low" +# } +# map_of_map_of_strings = { +# 'val1': 1, +# 'valText': "Text", +# 'valueDict': up_or_low_dict +# } +# indirect_map = { +# 'option1': True +# } +# direct_map = { +# 'option2': False +# } +# map_enum_test.map_of_enum_string = up_or_low_dict +# map_enum_test.map_map_of_string = map_of_map_of_strings +# map_enum_test.indirect_map = indirect_map +# map_enum_test.direct_map = direct_map +# +# self.assertEqual(map_enum_test.map_of_enum_string, up_or_low_dict) +# self.assertEqual(map_enum_test.map_map_of_string, map_of_map_of_strings) +# self.assertEqual(map_enum_test.indirect_map, indirect_map) +# self.assertEqual(map_enum_test.direct_map, direct_map) +# +# expected_dict = { +# 'map_of_enum_string': up_or_low_dict, +# 'map_map_of_string': map_of_map_of_strings, +# 'indirect_map': indirect_map, +# 'direct_map': direct_map +# } +# +# self.assertEqual(map_enum_test.to_dict(), expected_dict) diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_model.py b/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_model.py new file mode 100644 index 000000000000..01d5d001fab8 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_model.py @@ -0,0 +1,536 @@ +# coding: utf-8 + +# flake8: noqa + +import json +import os +import time +import unittest + +import petstore_api + + +class ModelTests(unittest.TestCase): + + def setUp(self): + self.pet = petstore_api.Pet(name="test name", photo_urls=["string"]) + self.pet.id = 1 + self.pet.status = "available" + cate = petstore_api.Category(name="dog") + cate.id = 1 + cate.name = "dog" + self.pet.category = cate + tag = petstore_api.Tag() + tag.id = 1 + self.pet.tags = [tag] + + def test_cat(self): + self.cat = petstore_api.Cat(class_name="cat") + self.assertEqual("cat", self.cat.class_name) + self.assertEqual("red", self.cat.color) + cat_str = ("{'additional_properties': {},\n" + " 'className': 'cat',\n" + " 'color': 'red',\n" + " 'declawed': None}") + self.assertEqual(cat_str, self.cat.to_str()) + + def test_to_str(self): + data = ("{'additional_properties': {},\n" + " 'category': {'additional_properties': {}, 'id': 1, 'name': 'dog'},\n" + " 'id': 1,\n" + " 'name': 'test name',\n" + " 'photoUrls': ['string'],\n" + " 'status': 'available',\n" + " 'tags': [{'additional_properties': {}, 'id': 1, 'name': None}]}") + self.assertEqual(data, self.pet.to_str()) + + def test_equal(self): + self.pet1 = petstore_api.Pet(name="test name", photo_urls=["string"]) + self.pet1.id = 1 + self.pet1.status = "available" + cate1 = petstore_api.Category(name="dog") + cate1.id = 1 + # cate1.name = "dog" + self.pet.category = cate1 + tag1 = petstore_api.Tag() + tag1.id = 1 + self.pet1.tags = [tag1] + + self.pet2 = petstore_api.Pet(name="test name", photo_urls=["string"]) + self.pet2.id = 1 + self.pet2.status = "available" + cate2 = petstore_api.Category(name="dog") + cate2.id = 1 + cate2.name = "dog" + self.pet.category = cate2 + tag2 = petstore_api.Tag() + tag2.id = 1 + self.pet2.tags = [tag2] + + self.assertTrue(self.pet1 == self.pet2) + + # reset pet1 tags to empty array so that object comparison returns false + self.pet1.tags = [] + self.assertFalse(self.pet1 == self.pet2) + + def test_oneOf_array_of_integers(self): + # test new Color + new_color = petstore_api.Color() + self.assertEqual("null", new_color.to_json()) + self.assertEqual(None, new_color.actual_instance) + + # test the oneof schema validator + json_str = '[12,34,56]' + array_of_integers = json.loads(json_str) + # no error should be thrown + new_color.oneof_schema_1_validator = array_of_integers + new_color.actual_instance = array_of_integers + new_color.actual_instance = None + + # test the oneof schema validator with invalid input + json_str = '[12,34,56120938]' + array_of_integers = json.loads(json_str) + try: + new_color.oneof_schema_1_validator = array_of_integers + except ValueError as e: + self.assertTrue("ensure this value is less than or equal to 255" in str(e)) + + try: + new_color.actual_instance = array_of_integers + except ValueError as e: + self.assertTrue("ensure this value is less than or equal to 255" in str(e)) + + # test from_josn + json_str = '[12,34,56]' + p = petstore_api.Color.from_json(json_str) + self.assertEqual(p.actual_instance, [12, 34, 56]) + + try: + p = petstore_api.Color.from_json('[2342112,0,0,0]') + except ValueError as e: + self.assertTrue("ensure this value is less than or equal to 255" in str(e)) + + # test to_json, to_dict method + json_str = '[12,34,56]' + p = petstore_api.Color.from_json(json_str) + self.assertEqual(p.to_json(), "[12, 34, 56]") + self.assertEqual(p.to_dict(), [12, 34, 56]) + + # test nullable + p = petstore_api.Color.from_json(None) + self.assertEqual(p.actual_instance, None) + + def test_oneof_enum_string(self): + enum_string1 = petstore_api.EnumString1('a') + # test from_json + oneof_enum = petstore_api.OneOfEnumString.from_json('"a"') + # test from_dict + oneof_enum = petstore_api.OneOfEnumString.from_dict("a") + nested = petstore_api.WithNestedOneOf(size = 1, nested_oneof_enum_string = oneof_enum) + # test to_json + self.assertEqual(nested.to_json(), '{"size": 1, "nested_oneof_enum_string": "a"}') + # test from_json + nested = petstore_api.WithNestedOneOf.from_json('{"size": 1, "nested_oneof_enum_string": "c"}') + self.assertEqual(nested.to_json(), '{"size": 1, "nested_oneof_enum_string": "c"}') + # test from_dict + nested = petstore_api.WithNestedOneOf.from_dict({"size": 1, "nested_oneof_enum_string": "c"}) + # test to_dict + self.assertEqual(nested.to_dict(), {"size": 1, "nested_oneof_enum_string": "c"}) + # invalid enum value + try: + nested2 = petstore_api.WithNestedOneOf.from_json('{"size": 1, "nested_oneof_enum_string": "e"}') + except ValueError as e: + self.assertTrue("'e' is not a valid EnumString1, 'e' is not a valid EnumString" in str(e)) + + # test the constructor + enum_string1 = petstore_api.EnumString1('a') + constructor1 = petstore_api.OneOfEnumString(actual_instance=enum_string1) + self.assertEqual(constructor1.actual_instance, enum_string1) + constructor2 = petstore_api.OneOfEnumString(enum_string1) + self.assertEqual(constructor2.actual_instance, enum_string1) + constructor3 = petstore_api.OneOfEnumString() + self.assertEqual(constructor3.actual_instance, None) + + def test_anyOf_array_of_integers(self): + # test new Color + new_color = petstore_api.AnyOfColor() + self.assertEqual("null", new_color.to_json()) + self.assertEqual(None, new_color.actual_instance) + + # test the oneof schema validator + json_str = '[12,34,56]' + array_of_integers = json.loads(json_str) + # no error should be thrown + new_color.anyof_schema_1_validator = array_of_integers + new_color.actual_instance = array_of_integers + + # test the oneof schema validator with invalid input + json_str = '[12,34,56120938]' + array_of_integers = json.loads(json_str) + try: + new_color.anyof_schema_1_validator = array_of_integers + except ValueError as e: + self.assertTrue("ensure this value is less than or equal to 255" in str(e)) + + try: + new_color.actual_instance = array_of_integers + except ValueError as e: + self.assertTrue("ensure this value is less than or equal to 255" in str(e)) + + # test from_josn + json_str = '[12,34,56]' + p = petstore_api.AnyOfColor.from_json(json_str) + self.assertEqual(p.actual_instance, [12, 34,56]) + + try: + p = petstore_api.AnyOfColor.from_json('[2342112,0,0,0]') + except ValueError as e: + self.assertTrue("ensure this value is less than or equal to 255" in str(e)) + + def test_oneOf(self): + # test new Pig + bp = petstore_api.BasquePig.from_dict({"className": "BasquePig", "color": "red"}) + new_pig = petstore_api.Pig() + self.assertEqual("null", new_pig.to_json()) + self.assertEqual(None, new_pig.actual_instance) + new_pig2 = petstore_api.Pig(actual_instance=bp) + self.assertEqual('{"className": "BasquePig", "color": "red"}', new_pig2.to_json()) + new_pig3 = petstore_api.Pig(bp) + self.assertEqual('{"className": "BasquePig", "color": "red"}', new_pig3.to_json()) + try: + new_pig4 = petstore_api.Pig(bp, actual_instance=bp) + except ValueError as e: + self.assertTrue("If position argument is used, keyword argument cannot be used.", str(e)) + try: + new_pig5 = petstore_api.Pig(bp, bp) + except ValueError as e: + self.assertTrue("If position argument is used, only 1 is allowed to set `actual_instance`", str(e)) + + # test from_json + json_str = '{"className": "BasquePig", "color": "red"}' + p = petstore_api.Pig.from_json(json_str) + self.assertIsInstance(p.actual_instance, petstore_api.BasquePig) + + # test from_dict + json_dict = {"className": "BasquePig", "color": "red"} + p = petstore_api.Pig.from_dict(json_dict) + self.assertIsInstance(p.actual_instance, petstore_api.BasquePig) + + # test init + basque_pig = p.actual_instance + pig2 = petstore_api.Pig(actual_instance=basque_pig) + self.assertIsInstance(pig2.actual_instance, petstore_api.BasquePig) + + # test failed init + try: + pig3 = petstore_api.Pig(actual_instance="123") + self.assertTrue(False) # this line shouldn't execute + except ValueError as e: + self.assertTrue("No match found when setting `actual_instance` in Pig with oneOf schemas: BasquePig, DanishPig" in str(e)) + + # failure + try: + p2 = petstore_api.Pig.from_json("1") + self.assertTrue(False) # this line shouldn't execute + except AttributeError as e: + self.assertEqual(str(e), "'int' object has no attribute 'get'") + # comment out below as the error message is different using oneOf discriminator lookup option + #except ValueError as e: + # error_message = ( + # "No match found when deserializing the JSON string into Pig with oneOf schemas: BasquePig, DanishPig. " + # "Details: 1 validation error for BasquePig\n" + # "__root__\n" + # " BasquePig expected dict not int (type=type_error), 1 validation error for DanishPig\n" + # "__root__\n" + # " DanishPig expected dict not int (type=type_error)") + # self.assertEqual(str(e), error_message) + + # test to_json + self.assertEqual(p.to_json(), '{"className": "BasquePig", "color": "red"}') + + # test nested property + nested = petstore_api.WithNestedOneOf(size = 1, nested_pig = p) + self.assertEqual(nested.to_json(), '{"size": 1, "nested_pig": {"className": "BasquePig", "color": "red"}}') + + nested_json = nested.to_json() + nested2 = petstore_api.WithNestedOneOf.from_json(nested_json) + self.assertEqual(nested2.to_json(), nested_json) + + def test_anyOf(self): + # test new AnyOfPig + new_anypig = petstore_api.AnyOfPig() + self.assertEqual("null", new_anypig.to_json()) + self.assertEqual(None, new_anypig.actual_instance) + + # test from_json + json_str = '{"className": "BasquePig", "color": "red"}' + p = petstore_api.AnyOfPig.from_json(json_str) + self.assertIsInstance(p.actual_instance, petstore_api.BasquePig) + + # test from_dict + json_dict = {"className": "BasquePig", "color": "red"} + p = petstore_api.AnyOfPig.from_dict(json_dict) + self.assertIsInstance(p.actual_instance, petstore_api.BasquePig) + + # test init + basque_pig = p.actual_instance + pig2 = petstore_api.AnyOfPig(actual_instance=basque_pig) + self.assertIsInstance(pig2.actual_instance, petstore_api.BasquePig) + + # test failed init + try: + pig3 = petstore_api.AnyOfPig(actual_instance="123") + self.assertTrue(False) # this line shouldn't execute + except ValueError as e: + self.assertTrue( + "No match found when setting the actual_instance in AnyOfPig with anyOf schemas: BasquePig, " + "DanishPig" in str(e)) + + # failure + try: + p2 = petstore_api.AnyOfPig.from_json("1") + self.assertTrue(False) # this line shouldn't execute + except ValueError as e: + error_message = ( + "No match found when deserializing the JSON string into AnyOfPig with anyOf schemas: BasquePig, " + "DanishPig. Details: 1 validation error for BasquePig\n" + "__root__\n" + " BasquePig expected dict not int (type=type_error), 1 validation error for DanishPig\n" + "__root__\n" + " DanishPig expected dict not int (type=type_error)") + self.assertEqual(str(e), error_message) + + # test to_json + self.assertEqual(p.to_json(), '{"className": "BasquePig", "color": "red"}') + + def test_inheritance(self): + dog = petstore_api.Dog(breed="bulldog", className="dog", color="white") + self.assertEqual(dog.to_json(), '{"className": "dog", "color": "white", "breed": "bulldog"}') + self.assertEqual(dog.to_dict(), {'breed': 'bulldog', 'className': + 'dog', 'color': 'white'}) + dog2 = petstore_api.Dog.from_json(dog.to_json()) + self.assertEqual(dog2.breed, 'bulldog') + self.assertEqual(dog2.class_name, "dog") + self.assertEqual(dog2.color, 'white') + + def test_list(self): + # should throw exception as var_123_list should be string + try: + l3 = petstore_api.List(var_123_list=123) + self.assertTrue(False) # this line shouldn't execute + except ValueError as e: + #error_message = ( + # "1 validation error for List\n" + # "123-list\n" + # " str type expected (type=type_error.str)\n") + self.assertTrue("str type expected" in str(e)) + + l = petstore_api.List(var_123_list="bulldog") + self.assertEqual(l.to_json(), '{"123-list": "bulldog"}') + self.assertEqual(l.to_dict(), {'123-list': 'bulldog'}) + l2 = petstore_api.List.from_json(l.to_json()) + self.assertEqual(l2.var_123_list, 'bulldog') + + self.assertTrue(isinstance(l2, petstore_api.List)) + + def test_enum_ref_property(self): + # test enum ref property + # test to_json + d = petstore_api.OuterObjectWithEnumProperty(value=petstore_api.OuterEnumInteger.NUMBER_1) + self.assertEqual(d.to_json(), '{"value": 1}') + d2 = petstore_api.OuterObjectWithEnumProperty(value=petstore_api.OuterEnumInteger.NUMBER_1, str_value=petstore_api.OuterEnum.DELIVERED) + self.assertEqual(d2.to_json(), '{"str_value": "delivered", "value": 1}') + # test from_json (round trip) + d3 = petstore_api.OuterObjectWithEnumProperty.from_json(d2.to_json()) + self.assertEqual(d3.str_value, petstore_api.OuterEnum.DELIVERED) + self.assertEqual(d3.value, petstore_api.OuterEnumInteger.NUMBER_1) + self.assertEqual(d3.to_json(), '{"str_value": "delivered", "value": 1}') + d4 = petstore_api.OuterObjectWithEnumProperty(value=petstore_api.OuterEnumInteger.NUMBER_1, str_value=None) + self.assertEqual(d4.to_json(), '{"value": 1, "str_value": null}') + d5 = petstore_api.OuterObjectWithEnumProperty(value=petstore_api.OuterEnumInteger.NUMBER_1) + self.assertEqual(d5.__fields_set__, {'value'}) + d5.str_value = None # set None explicitly + self.assertEqual(d5.__fields_set__, {'value', 'str_value'}) + self.assertEqual(d5.to_json(), '{"value": 1, "str_value": null}') + + def test_valdiator(self): + # test regular expression + a = petstore_api.FormatTest(number=123.45, byte=bytes("string", 'utf-8'), date="2013-09-17", password="testing09876") + try: + a.pattern_with_digits_and_delimiter = "123" + self.assertTrue(False) # this line shouldn't execute + except ValueError as e: + self.assertTrue(r"must validate the regular expression /^image_\d{1,3}$/i" in str(e)) + + # test None with optional string (with regualr expression) + a = petstore_api.FormatTest(number=123.45, byte=bytes("string", 'utf-8'), date="2013-09-17", password="testing09876") + a.string = None # shouldn't throw an exception + + a.pattern_with_digits_and_delimiter = "IMAGE_123" + self.assertEqual(a.pattern_with_digits_and_delimiter, "IMAGE_123") + a.pattern_with_digits_and_delimiter = "image_123" + self.assertEqual(a.pattern_with_digits_and_delimiter, "image_123") + + def test_inline_enum_validator(self): + self.pet = petstore_api.Pet(name="test name", photo_urls=["string"]) + self.pet.id = 1 + try: + self.pet.status = "error" + self.assertTrue(False) # this line shouldn't execute + except ValueError as e: + self.assertTrue("must be one of enum values ('available', 'pending', 'sold')" in str(e)) + + def test_object_id(self): + pet_ap = petstore_api.Pet(name="test name", photo_urls=["string"]) + pet_ap2 = petstore_api.Pet(name="test name", photo_urls=["string"]) + self.assertNotEqual(id(pet_ap), id(pet_ap2)) + + pet_ap3 = petstore_api.Pet.from_dict(pet_ap.to_dict()) + pet_ap4 = petstore_api.Pet.from_dict(pet_ap.to_dict()) + self.assertNotEqual(id(pet_ap3), id(pet_ap4)) + + + def test_additional_properties(self): + pet_ap = petstore_api.Pet(name="test name", photo_urls=["string"]) + pet_ap.id = 1 + pet_ap.status = "available" + + pet_ap2 = petstore_api.Pet(name="test name", photo_urls=["string"]) + pet_ap2.id = 1 + pet_ap2.status = "available" + + self.assertNotEqual(id(pet_ap.additional_properties), id(pet_ap2.additional_properties)) + + pet_ap.additional_properties["something-new"] = "haha" + self.assertEqual(pet_ap.to_json(), '{"id": 1, "name": "test name", "photoUrls": ["string"], "status": "available", "something-new": "haha"}') + self.assertEqual(type(pet_ap2.additional_properties), dict) + self.assertNotEqual(id(pet_ap.additional_properties), id(pet_ap2.additional_properties)) + self.assertEqual(pet_ap.additional_properties["something-new"], "haha") + + try: + _tmp = pet_ap2.additional_properties["something-new"] + self.assertTrue(False) # this line shouldn't execute + except KeyError as e: + self.assertEqual("'something-new'", str(e)) + + pet_ap_dict = pet_ap.to_dict() + pet_ap_dict["something-new"] = 123 + pet_ap_dict["array"] = ["a", "b"] + pet_ap_dict["dict"] = {"key999": "value999"} + + pet_ap2 = petstore_api.Pet.from_dict(pet_ap_dict) + + self.assertEqual(pet_ap2.additional_properties["array"], ["a", "b"]) + self.assertEqual(pet_ap2.additional_properties["something-new"], 123) + self.assertEqual(pet_ap2.additional_properties["dict"], {"key999": "value999"}) + + def test_nullable(self): + h = petstore_api.HealthCheckResult(nullable_message="Not none") + self.assertEqual(h.to_json(), '{"NullableMessage": "Not none"}') + + h.nullable_message = None + self.assertEqual(h.to_json(), '{"NullableMessage": null}') + + #import json + #dictionary ={ + # "id": "04", + # "name": "sunil", + # "department": None + #} + # + ## Serializing json + #json_object = json.dumps(dictionary) + #self.assertEqual(json_object, "") + + def test_inline_enum_default(self): + enum_test = petstore_api.EnumTest(enum_string_required="lower") + self.assertEqual(enum_test.enum_integer_default, 5) + + def test_object_with_optional_dict(self): + # for https://github.com/OpenAPITools/openapi-generator/issues/14913 + # shouldn't throw exception by the optional dict property + a = petstore_api.ParentWithOptionalDict.from_dict({}) + self.assertFalse(a is None) + + b = petstore_api.ParentWithOptionalDict.from_dict({"optionalDict": {"key": {"aProperty": {"a": "b"}}}}) + self.assertFalse(b is None) + self.assertEqual(b.optional_dict["key"].a_property["a"], "b") + + def test_object_with_dict_of_dict_of_object(self): + # for https://github.com/OpenAPITools/openapi-generator/issues/15135 + d = {"optionalDict": {"a": {"b": {"aProperty": "value"}}}} + a = petstore_api.Parent.from_dict(d) + self.assertEqual(a.to_dict(), d) + + def test_eum_class(self): + a = petstore_api.EnumClass("-efg") + self.assertEqual(a.value, "-efg") + self.assertEqual(a.name, "MINUS_EFG") + self.assertEqual(a, "-efg") + + def test_nullable_property_pattern(self): + a = petstore_api.NullableProperty(id=12, name=None) + self.assertEqual(a.id, 12) + self.assertEqual(a.name, None) + + def test_int_or_string_oneof(self): + a = petstore_api.IntOrString("-efg") + self.assertEqual(a.actual_instance, "-efg") + a = petstore_api.IntOrString(100) + self.assertEqual(a.actual_instance, 100) + + try: + a = petstore_api.IntOrString(1) + except ValueError as e: + self.assertTrue("ensure this value is greater than or equal to 10" in str(e)) + + def test_map_of_array_of_model(self): + a = petstore_api.MapOfArrayOfModel() + t = petstore_api.Tag(id=123, name="tag name") + a.shop_id_to_org_online_lip_map = {"somekey": [t]} + self.assertEqual(a.to_dict(), {'shopIdToOrgOnlineLipMap': {'somekey': [{'id': 123, 'name': 'tag name'}]}}) + self.assertEqual(a.to_json(), '{"shopIdToOrgOnlineLipMap": {"somekey": [{"id": 123, "name": "tag name"}]}}') + a2 = petstore_api.MapOfArrayOfModel.from_dict(a.to_dict()) + self.assertEqual(a.to_dict(), a2.to_dict()) + + def test_array_of_array_of_model(self): + a = petstore_api.ArrayOfArrayOfModel() + t = petstore_api.Tag(id=123, name="tag name") + a.another_property = [[t]] + self.assertEqual(a.to_dict(), {'another_property': [[ {'id': 123, 'name': 'tag name'} ]]}) + self.assertEqual(a.to_json(), '{"another_property": [[{"id": 123, "name": "tag name"}]]}') + a2 = petstore_api.ArrayOfArrayOfModel.from_dict(a.to_dict()) + self.assertEqual(a.to_dict(), a2.to_dict()) + + def test_object_with_additional_properties(self): + a = petstore_api.ObjectToTestAdditionalProperties() + a.additional_properties = { "abc": 123 } + # should not throw the following errors: + # pydantic.errors.ConfigError: field "additional_properties" not yet prepared so type is still a ForwardRef, you might need to call ObjectToTestAdditionalProperties.update_forward_refs(). + + def test_first_ref(self): + # shouldn't throw "still a ForwardRef" error + a = petstore_api.FirstRef.from_dict({}) + self.assertEqual(a.to_json(), "{}") + + def test_allof(self): + # for issue 16104 + model = petstore_api.Tiger.from_json('{"skill": "none", "type": "tiger", "info": {"name": "creature info"}}') + # shouldn't throw NameError + self.assertEqual(model.to_json(), '{"skill": "none", "type": "tiger", "info": {"name": "creature info"}}') + + def test_additional_properties(self): + a1 = petstore_api.AdditionalPropertiesAnyType() + a1.additional_properties = { "abc": 123 } + self.assertEqual(a1.to_dict(), {"abc": 123}) + self.assertEqual(a1.to_json(), "{\"abc\": 123}") + + a2 = petstore_api.AdditionalPropertiesObject() + a2.additional_properties = { "efg": 45.6 } + self.assertEqual(a2.to_dict(), {"efg": 45.6}) + self.assertEqual(a2.to_json(), "{\"efg\": 45.6}") + + a3 = petstore_api.AdditionalPropertiesWithDescriptionOnly() + a3.additional_properties = { "xyz": 45.6 } + self.assertEqual(a3.to_dict(), {"xyz": 45.6}) + self.assertEqual(a3.to_json(), "{\"xyz\": 45.6}") diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_order_model.py b/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_order_model.py new file mode 100644 index 000000000000..7d4afba5b1db --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_order_model.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +# flake8: noqa + +import os +import time +import unittest + +import petstore_api + + +class OrderModelTests(unittest.TestCase): + + def test_status(self): + order = petstore_api.Order() + # order.status = "placed" + # self.assertEqual("placed", order.status) + + # with self.assertRaises(ValueError): + # order.status = "invalid" diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_pet_api.py b/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_pet_api.py new file mode 100644 index 000000000000..1d816b8d1dbe --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_pet_api.py @@ -0,0 +1,269 @@ +# coding: utf-8 + +# flake8: noqa + +""" +Run the tests. +$ docker pull swaggerapi/petstore +$ docker run -d -e SWAGGER_HOST=http://petstore.swagger.io -e SWAGGER_BASE_PATH=/v2 -p 80:8080 swaggerapi/petstore +$ pip install -U pytest +$ cd petstore_api-python +$ pytest +""" + +import os +import unittest + +import petstore_api +from petstore_api import Configuration +from petstore_api.rest import ApiException + +from .util import id_gen + +import json + +import urllib3 + +HOST = 'http://localhost/v2' + + +class TimeoutWithEqual(urllib3.Timeout): + def __init__(self, *arg, **kwargs): + super(TimeoutWithEqual, self).__init__(*arg, **kwargs) + + def __eq__(self, other): + return self._read == other._read and self._connect == other._connect and self.total == other.total + + +class MockPoolManager(object): + def __init__(self, tc): + self._tc = tc + self._reqs = [] + + def expect_request(self, *args, **kwargs): + self._reqs.append((args, kwargs)) + + def request(self, *args, **kwargs): + self._tc.assertTrue(len(self._reqs) > 0) + r = self._reqs.pop(0) + self._tc.maxDiff = None + self._tc.assertEqual(r[0], args) + self._tc.assertEqual(r[1], kwargs) + return urllib3.HTTPResponse(status=200, body=b'test') + + +class PetApiTests(unittest.TestCase): + + def setUp(self): + config = Configuration() + config.host = HOST + config.access_token = 'ACCESS_TOKEN' + self.api_client = petstore_api.ApiClient(config) + self.pet_api = petstore_api.PetApi(self.api_client) + self.setUpModels() + self.setUpFiles() + + def setUpModels(self): + self.category = petstore_api.Category(name="dog") + self.category.id = id_gen() + # self.category.name = "dog" + self.tag = petstore_api.Tag() + self.tag.id = id_gen() + self.tag.name = "python-pet-tag" + self.pet = petstore_api.Pet(name="hello kity", photo_urls=["http://foo.bar.com/1", "http://foo.bar.com/2"]) + self.pet.id = id_gen() + self.pet.status = "sold" + self.pet.category = self.category + self.pet.tags = [self.tag] + + self.pet2 = petstore_api.Pet(name="superman 2", photo_urls=["http://foo.bar.com/1", "http://foo.bar.com/2"]) + self.pet2.id = id_gen() + 1 + self.pet2.status = "available" + self.pet2.category = self.category + self.pet2.tags = [self.tag] + + def setUpFiles(self): + self.test_file_dir = os.path.join(os.path.dirname(__file__), "..", "testfiles") + self.test_file_dir = os.path.realpath(self.test_file_dir) + self.foo = os.path.join(self.test_file_dir, "pix.gif") + + def test_timeout(self): + mock_pool = MockPoolManager(self) + self.api_client.rest_client.pool_manager = mock_pool + + mock_pool.expect_request('POST', HOST + '/pet', + body=json.dumps(self.api_client.sanitize_for_serialization(self.pet)), + headers={'Content-Type': 'application/json', + 'Authorization': 'Bearer ACCESS_TOKEN', + 'User-Agent': 'OpenAPI-Generator/1.0.0/python'}, + preload_content=True, timeout=TimeoutWithEqual(total=5)) + mock_pool.expect_request('POST', HOST + '/pet', + body=json.dumps(self.api_client.sanitize_for_serialization(self.pet)), + headers={'Content-Type': 'application/json', + 'Authorization': 'Bearer ACCESS_TOKEN', + 'User-Agent': 'OpenAPI-Generator/1.0.0/python'}, + preload_content=True, timeout=TimeoutWithEqual(connect=1, read=2)) + + self.pet_api.add_pet(self.pet, _request_timeout=5) + self.pet_api.add_pet(self.pet, _request_timeout=(1, 2)) + + def test_separate_default_config_instances(self): + # ensure the default api client is used + pet_api = petstore_api.PetApi() + pet_api2 = petstore_api.PetApi() + self.assertEqual(id(pet_api.api_client), id(pet_api2.api_client)) + # ensure the default configuration is used + self.assertEqual(id(pet_api.api_client.configuration), id(pet_api2.api_client.configuration)) + + def test_async_request(self): + thread = self.pet_api.add_pet(self.pet, async_req=True) + response = thread.get() + self.assertIsNone(response) + + thread = self.pet_api.get_pet_by_id(self.pet.id, async_req=True) + result = thread.get() + self.assertIsInstance(result, petstore_api.Pet) + + def test_async_with_result(self): + self.pet_api.add_pet(self.pet, async_req=False) + + thread = self.pet_api.get_pet_by_id(self.pet.id, async_req=True) + thread2 = self.pet_api.get_pet_by_id(self.pet.id, async_req=True) + + response = thread.get() + response2 = thread2.get() + + self.assertEqual(response.id, self.pet.id) + self.assertIsNotNone(response2.id, self.pet.id) + + def test_async_with_http_info(self): + self.pet_api.add_pet(self.pet) + + thread = self.pet_api.get_pet_by_id_with_http_info(self.pet.id, async_req=True) + api_response_object = thread.get() + + self.assertIsInstance(api_response_object.data, petstore_api.Pet) + self.assertEqual(api_response_object.status_code, 200) + self.assertEqual(api_response_object.headers['Content-Type'], "application/json") + self.assertIsInstance(api_response_object.raw_data, str) # it's a str, not Pet + self.assertTrue(api_response_object.raw_data.startswith('{"id":')) + + def test_async_exception(self): + self.pet_api.add_pet(self.pet) + + thread = self.pet_api.get_pet_by_id(9999999999999, async_req=True) + + exception = None + try: + thread.get() + except ApiException as e: + exception = e + + self.assertIsInstance(exception, ApiException) + self.assertEqual(exception.status, 404) + + def test_add_pet_and_get_pet_by_id(self): + self.pet_api.add_pet(self.pet) + + fetched = self.pet_api.get_pet_by_id(pet_id=self.pet.id) + self.assertIsNotNone(fetched) + self.assertEqual(self.pet.id, fetched.id) + self.assertIsNotNone(fetched.category) + self.assertEqual(self.pet.category.name, fetched.category.name) + + def test_add_pet_and_get_pet_by_id_with_preload_content_flag(self): + try: + self.pet_api.add_pet(self.pet, _preload_content=False) + except ValueError as e: + self.assertEqual("Error! Please call the add_pet_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data", str(e)) + + self.pet_api.add_pet(self.pet) + fetched = self.pet_api.get_pet_by_id_with_http_info(pet_id=self.pet.id, + _preload_content=False) + self.assertIsNone(fetched.data) + self.assertIsInstance(fetched.raw_data, bytes) # it's a str, not Pet + self.assertTrue(fetched.raw_data.decode("utf-8").startswith('{"id":')) + + def test_add_pet_and_get_pet_by_id_with_http_info(self): + self.pet_api.add_pet(self.pet) + + # fetched is an ApiResponse object + fetched = self.pet_api.get_pet_by_id_with_http_info(pet_id=self.pet.id) + self.assertIsNotNone(fetched.data) + self.assertEqual(self.pet.id, fetched.data.id) + self.assertIsNotNone(fetched.data.category) + self.assertEqual(self.pet.category.name, fetched.data.category.name) + + def test_update_pet(self): + self.pet.name = "hello kity with updated" + self.pet_api.update_pet(self.pet) + + fetched = self.pet_api.get_pet_by_id(pet_id=self.pet.id) + self.assertIsNotNone(fetched) + self.assertEqual(self.pet.id, fetched.id) + self.assertEqual(self.pet.name, fetched.name) + self.assertIsNotNone(fetched.category) + self.assertEqual(fetched.category.name, self.pet.category.name) + + def test_find_pets_by_status(self): + self.pet_api.add_pet(self.pet) + self.pet_api.add_pet(self.pet2) + + results = self.pet_api.find_pets_by_status(status=["pending", "available"]) + self.assertIsInstance(results, list) + self.assertTrue(len(results) > 1) + # TODO + #for result in results: + # self.assertTrue(result.status in ["sold", "available"]) + + def test_find_pets_by_tags(self): + self.pet_api.add_pet(self.pet) + + self.assertIn( + self.pet.id, + list(map(lambda x: getattr(x, 'id'), self.pet_api.find_pets_by_tags(tags=[self.tag.name, "here is another tag"]))) + ) + + def test_update_pet_with_form(self): + self.pet_api.add_pet(self.pet) + + name = "hello kity with form updated abc" + status = "pending" + self.pet_api.update_pet_with_form(pet_id=self.pet.id, name=name, status=status) + + fetched = self.pet_api.get_pet_by_id(pet_id=self.pet.id) + self.assertEqual(self.pet.id, fetched.id) + self.assertEqual(name, fetched.name) + self.assertEqual(status, fetched.status) + + def test_upload_file(self): + # upload file with form parameter + try: + additional_metadata = "special data 123" + self.pet_api.upload_file( + pet_id=self.pet.id, + additional_metadata=additional_metadata, + file=self.foo + ) + except ApiException as e: + self.fail("upload_file() raised {0} unexpectedly".format(type(e))) + + # upload only file + try: + self.pet_api.upload_file(pet_id=self.pet.id, file=self.foo) + except ApiException as e: + self.fail("upload_file() raised {0} unexpectedly".format(type(e))) + + def test_delete_pet(self): + self.pet_api.add_pet(self.pet) + self.pet_api.delete_pet(pet_id=self.pet.id, api_key="special-key") + + try: + self.pet_api.get_pet_by_id(pet_id=self.pet.id) + raise Exception("expected an error") + except ApiException as e: + self.assertEqual(404, e.status) + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_pet_model.py b/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_pet_model.py new file mode 100644 index 000000000000..2c8b2f403263 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_pet_model.py @@ -0,0 +1,115 @@ +# coding: utf-8 + +# flake8: noqa + +import os +import time +import unittest + +import petstore_api +import json +from pydantic import ValidationError + + +class PetModelTests(unittest.TestCase): + + def setUp(self): + self.pet = petstore_api.Pet(name="test name", photo_urls=["string"]) + self.pet.id = 1 + self.pet.status = "available" + cate = petstore_api.Category(name="dog") + cate.id = 1 + # cate.name = "dog" + self.pet.category = cate + tag = petstore_api.Tag() + tag.id = 1 + self.pet.tags = [tag] + + def test_to_str(self): + data = ("{'additional_properties': {},\n" + " 'category': {'additional_properties': {}, 'id': 1, 'name': 'dog'},\n" + " 'id': 1,\n" + " 'name': 'test name',\n" + " 'photoUrls': ['string'],\n" + " 'status': 'available',\n" + " 'tags': [{'additional_properties': {}, 'id': 1, 'name': None}]}") + self.assertEqual(data, self.pet.to_str()) + + def test_equal(self): + self.pet1 = petstore_api.Pet(name="test name", photo_urls=["string"]) + self.pet1.id = 1 + self.pet1.status = "available" + cate1 = petstore_api.Category(name="dog") + cate1.id = 1 + # cate1.name = "dog" + self.pet1.category = cate1 + tag1 = petstore_api.Tag() + tag1.id = 1 + self.pet1.tags = [tag1] + + self.pet2 = petstore_api.Pet(name="test name", photo_urls=["string"]) + self.pet2.id = 1 + self.pet2.status = "available" + cate2 = petstore_api.Category(name="dog") + cate2.id = 1 + # cate2.name = "dog" + self.pet2.category = cate2 + tag2 = petstore_api.Tag() + tag2.id = 1 + self.pet2.tags = [tag2] + + self.assertTrue(self.pet1 == self.pet2) + + # reset pet1 tags to empty array so that object comparison returns false + self.pet1.tags = [] + self.assertFalse(self.pet1 == self.pet2) + + # test from_json, to_json, to_dict, from_dict + def test_from_to_methods(self): + json_str = ("{\"category\": {\"id\": 1, \"name\": \"dog\"},\n" + " \"id\": 1,\n" + " \"name\": \"test name\",\n" + " \"photoUrls\": [\"string\"],\n" + " \"status\": \"available\",\n" + " \"tags\": [{\"id\": 1, \"name\": \"None\"}]}") + pet = petstore_api.Pet.from_json(json_str) + self.assertEqual(pet.id, 1) + self.assertEqual(pet.status, "available") + self.assertEqual(pet.photo_urls, ["string"]) + self.assertEqual(pet.tags[0].id, 1) + self.assertEqual(pet.tags[0].name, "None") + self.assertEqual(pet.category.id, 1) + # test to_json + self.assertEqual(pet.to_json(), + '{"id": 1, "category": {"id": 1, "name": "dog"}, "name": "test name", "photoUrls": [' + '"string"], "tags": [{"id": 1, "name": "None"}], "status": "available"}') + + # test to_dict + self.assertEqual(pet.to_dict(), + {"id": 1, "category": {"id": 1, "name": "dog"}, "name": "test name", "photoUrls": ["string"], + "tags": [{"id": 1, "name": "None"}], "status": "available"}) + + # test from_dict + pet2 = petstore_api.Pet.from_dict(pet.to_dict()) + self.assertEqual(pet2.id, 1) + self.assertEqual(pet2.status, "available") + self.assertEqual(pet2.photo_urls, ["string"]) + self.assertEqual(pet2.tags[0].id, 1) + self.assertEqual(pet2.tags[0].name, "None") + self.assertEqual(pet2.category.id, 1) + + def test_unpack_operator(self): + d = {"name": "required name", "id": 123, "photoUrls": ["https://a.com", "https://b.com"]} + pet = petstore_api.Pet(**d) + self.assertEqual(pet.to_json(), '{"id": 123, "name": "required name", "photoUrls": ["https://a.com", "https://b.com"]}') + self.assertEqual(pet.to_dict(), {"id": 123, "name": "required name", "photoUrls": ["https://a.com", "https://b.com"]}) + + def test_optional_fields(self): + _pet = petstore_api.Pet(name="required name", + photoUrls=["https://a.com", + "https://b.com"]) + self.assertEqual(_pet.to_json(), '{"name": "required name", "photoUrls": ["https://a.com", "https://b.com"]}') + self.assertEqual(_pet.to_dict(), {"name": "required name", "photoUrls": ["https://a.com", "https://b.com"]}) + + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_store_api.py b/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_store_api.py new file mode 100644 index 000000000000..178e44fd1fef --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_store_api.py @@ -0,0 +1,32 @@ +# coding: utf-8 + +# flake8: noqa + +""" +Run the tests. +$ pip install -U pytest +$ cd OpenAP/Petstore-python +$ pytest +""" + +import os +import time +import unittest + +import petstore_api +from petstore_api.rest import ApiException + + +class StoreApiTests(unittest.TestCase): + + def setUp(self): + self.store_api = petstore_api.StoreApi() + + def tearDown(self): + # sleep 1 sec between two every 2 tests + time.sleep(1) + + def test_get_inventory(self): + data = self.store_api.get_inventory() + self.assertIsNotNone(data) + self.assertTrue(isinstance(data, dict)) diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/tests/util.py b/samples/openapi3/client/petstore/python-pydantic-v1/tests/util.py new file mode 100644 index 000000000000..113d7dcc5478 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/tests/util.py @@ -0,0 +1,8 @@ +# flake8: noqa + +import random + + +def id_gen(bits=32): + """ Returns a n-bit randomly generated int """ + return int(random.getrandbits(bits)) diff --git a/samples/openapi3/client/petstore/python/pom.xml b/samples/openapi3/client/petstore/python/pom.xml index c418fd8a4e4f..f3297df35ef4 100755 --- a/samples/openapi3/client/petstore/python/pom.xml +++ b/samples/openapi3/client/petstore/python/pom.xml @@ -1,7 +1,7 @@ 4.0.0 org.openapitools - PythonNextgenPetstoreTests + PythonPetstoreTests pom 1.0-SNAPSHOT Python OpenAPI3 Petstore Client From 82e84a12fc00899b244804e9dea63f1d57b2028c Mon Sep 17 00:00:00 2001 From: William Cheng Date: Mon, 25 Sep 2023 13:18:52 +0800 Subject: [PATCH 4/7] copy echo api tests --- .../echo_api/python-pydantic-v1/README.md | 2 +- .../python-pydantic-v1/test/test_bird.py | 20 +- .../python-pydantic-v1/test/test_body_api.py | 60 +----- .../python-pydantic-v1/test/test_category.py | 20 +- .../test/test_data_query.py | 22 ++- .../test/test_default_value.py | 34 ++-- .../python-pydantic-v1/test/test_form_api.py | 25 +-- .../test/test_header_api.py | 18 +- .../python-pydantic-v1/test/test_manual.py | 187 ++++++++++++++++++ .../test/test_number_properties_only.py | 20 +- .../python-pydantic-v1/test/test_path_api.py | 18 +- .../python-pydantic-v1/test/test_pet.py | 28 +-- .../python-pydantic-v1/test/test_query.py | 20 +- .../python-pydantic-v1/test/test_query_api.py | 57 ++---- .../test/test_string_enum_ref.py | 10 +- .../python-pydantic-v1/test/test_tag.py | 20 +- ...ue_object_all_of_query_object_parameter.py | 24 +-- ...rue_array_string_query_object_parameter.py | 18 +- .../python-pydantic-v1/testfiles/test.gif | Bin 0 -> 43 bytes 19 files changed, 366 insertions(+), 237 deletions(-) create mode 100644 samples/client/echo_api/python-pydantic-v1/test/test_manual.py create mode 100644 samples/client/echo_api/python-pydantic-v1/testfiles/test.gif diff --git a/samples/client/echo_api/python-pydantic-v1/README.md b/samples/client/echo_api/python-pydantic-v1/README.md index 89af693938f6..d9de36cb6e2d 100644 --- a/samples/client/echo_api/python-pydantic-v1/README.md +++ b/samples/client/echo_api/python-pydantic-v1/README.md @@ -5,7 +5,7 @@ This Python package is automatically generated by the [OpenAPI Generator](https: - API version: 0.1.0 - Package version: 1.0.0 -- Build package: org.openapitools.codegen.languages.PythonPydanticV1ClientCodegen +- Build package: org.openapitools.codegen.languages.PythonClientCodegen ## Requirements. diff --git a/samples/client/echo_api/python-pydantic-v1/test/test_bird.py b/samples/client/echo_api/python-pydantic-v1/test/test_bird.py index 0ce8736bd8a6..d95a104d7147 100644 --- a/samples/client/echo_api/python-pydantic-v1/test/test_bird.py +++ b/samples/client/echo_api/python-pydantic-v1/test/test_bird.py @@ -3,20 +3,22 @@ """ Echo Server API - Echo Server API + Echo Server API # noqa: E501 The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import openapi_client from openapi_client.models.bird import Bird # noqa: E501 +from openapi_client.rest import ApiException class TestBird(unittest.TestCase): """Bird unit test stubs""" @@ -27,20 +29,20 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> Bird: + def make_instance(self, include_optional): """Test Bird include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Bird` """ - model = Bird() # noqa: E501 - if include_optional: + model = openapi_client.models.bird.Bird() # noqa: E501 + if include_optional : return Bird( - size = '', + size = '', color = '' ) - else: + else : return Bird( ) """ diff --git a/samples/client/echo_api/python-pydantic-v1/test/test_body_api.py b/samples/client/echo_api/python-pydantic-v1/test/test_body_api.py index c98a3ed7e651..e5e24ace8102 100644 --- a/samples/client/echo_api/python-pydantic-v1/test/test_body_api.py +++ b/samples/client/echo_api/python-pydantic-v1/test/test_body_api.py @@ -3,79 +3,39 @@ """ Echo Server API - Echo Server API + Echo Server API # noqa: E501 The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest +import openapi_client from openapi_client.api.body_api import BodyApi # noqa: E501 +from openapi_client.rest import ApiException class TestBodyApi(unittest.TestCase): """BodyApi unit test stubs""" - def setUp(self) -> None: - self.api = BodyApi() # noqa: E501 - - def tearDown(self) -> None: - pass - - def test_test_binary_gif(self) -> None: - """Test case for test_binary_gif - - Test binary (gif) response body # noqa: E501 - """ - pass - - def test_test_body_application_octetstream_binary(self) -> None: - """Test case for test_body_application_octetstream_binary + def setUp(self): + self.api = openapi_client.api.body_api.BodyApi() # noqa: E501 - Test body parameter(s) # noqa: E501 - """ + def tearDown(self): pass - def test_test_body_multipart_formdata_array_of_binary(self) -> None: - """Test case for test_body_multipart_formdata_array_of_binary - - Test array of binary in multipart mime # noqa: E501 - """ - pass - - def test_test_echo_body_free_form_object_response_string(self) -> None: - """Test case for test_echo_body_free_form_object_response_string - - Test free form object # noqa: E501 - """ - pass - - def test_test_echo_body_pet(self) -> None: + def test_test_echo_body_pet(self): """Test case for test_echo_body_pet Test body parameter(s) # noqa: E501 """ pass - def test_test_echo_body_pet_response_string(self) -> None: - """Test case for test_echo_body_pet_response_string - - Test empty response body # noqa: E501 - """ - pass - - def test_test_echo_body_tag_response_string(self) -> None: - """Test case for test_echo_body_tag_response_string - - Test empty json (request body) # noqa: E501 - """ - pass - if __name__ == '__main__': unittest.main() diff --git a/samples/client/echo_api/python-pydantic-v1/test/test_category.py b/samples/client/echo_api/python-pydantic-v1/test/test_category.py index 487e50d95d5c..b5771c572d33 100644 --- a/samples/client/echo_api/python-pydantic-v1/test/test_category.py +++ b/samples/client/echo_api/python-pydantic-v1/test/test_category.py @@ -3,20 +3,22 @@ """ Echo Server API - Echo Server API + Echo Server API # noqa: E501 The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import openapi_client from openapi_client.models.category import Category # noqa: E501 +from openapi_client.rest import ApiException class TestCategory(unittest.TestCase): """Category unit test stubs""" @@ -27,20 +29,20 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> Category: + def make_instance(self, include_optional): """Test Category include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Category` """ - model = Category() # noqa: E501 - if include_optional: + model = openapi_client.models.category.Category() # noqa: E501 + if include_optional : return Category( - id = 1, + id = 1, name = 'Dogs' ) - else: + else : return Category( ) """ diff --git a/samples/client/echo_api/python-pydantic-v1/test/test_data_query.py b/samples/client/echo_api/python-pydantic-v1/test/test_data_query.py index 5ae6bdbf8778..f33d8daabae1 100644 --- a/samples/client/echo_api/python-pydantic-v1/test/test_data_query.py +++ b/samples/client/echo_api/python-pydantic-v1/test/test_data_query.py @@ -3,20 +3,22 @@ """ Echo Server API - Echo Server API + Echo Server API # noqa: E501 The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import openapi_client from openapi_client.models.data_query import DataQuery # noqa: E501 +from openapi_client.rest import ApiException class TestDataQuery(unittest.TestCase): """DataQuery unit test stubs""" @@ -27,21 +29,21 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> DataQuery: + def make_instance(self, include_optional): """Test DataQuery include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `DataQuery` """ - model = DataQuery() # noqa: E501 - if include_optional: + model = openapi_client.models.data_query.DataQuery() # noqa: E501 + if include_optional : return DataQuery( - suffix = '', - text = 'Some text', + suffix = '', + text = 'Some text', var_date = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f') ) - else: + else : return DataQuery( ) """ diff --git a/samples/client/echo_api/python-pydantic-v1/test/test_default_value.py b/samples/client/echo_api/python-pydantic-v1/test/test_default_value.py index a38f9d85c970..6e5f35fd2eff 100644 --- a/samples/client/echo_api/python-pydantic-v1/test/test_default_value.py +++ b/samples/client/echo_api/python-pydantic-v1/test/test_default_value.py @@ -3,20 +3,22 @@ """ Echo Server API - Echo Server API + Echo Server API # noqa: E501 The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import openapi_client from openapi_client.models.default_value import DefaultValue # noqa: E501 +from openapi_client.rest import ApiException class TestDefaultValue(unittest.TestCase): """DefaultValue unit test stubs""" @@ -27,40 +29,34 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> DefaultValue: + def make_instance(self, include_optional): """Test DefaultValue include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `DefaultValue` """ - model = DefaultValue() # noqa: E501 - if include_optional: + model = openapi_client.models.default_value.DefaultValue() # noqa: E501 + if include_optional : return DefaultValue( - array_string_enum_ref_default = [ - 'success' - ], array_string_enum_default = [ 'success' - ], + ], array_string_default = [ '' - ], + ], array_integer_default = [ 56 - ], + ], array_string = [ '' - ], + ], array_string_nullable = [ '' - ], - array_string_extension_nullable = [ - '' - ], + ], string_nullable = '' ) - else: + else : return DefaultValue( ) """ diff --git a/samples/client/echo_api/python-pydantic-v1/test/test_form_api.py b/samples/client/echo_api/python-pydantic-v1/test/test_form_api.py index c14aed194416..6422432c79ba 100644 --- a/samples/client/echo_api/python-pydantic-v1/test/test_form_api.py +++ b/samples/client/echo_api/python-pydantic-v1/test/test_form_api.py @@ -3,44 +3,39 @@ """ Echo Server API - Echo Server API + Echo Server API # noqa: E501 The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest +import openapi_client from openapi_client.api.form_api import FormApi # noqa: E501 +from openapi_client.rest import ApiException class TestFormApi(unittest.TestCase): """FormApi unit test stubs""" - def setUp(self) -> None: - self.api = FormApi() # noqa: E501 + def setUp(self): + self.api = openapi_client.api.form_api.FormApi() # noqa: E501 - def tearDown(self) -> None: + def tearDown(self): pass - def test_test_form_integer_boolean_string(self) -> None: + def test_test_form_integer_boolean_string(self): """Test case for test_form_integer_boolean_string Test form parameter(s) # noqa: E501 """ pass - def test_test_form_oneof(self) -> None: - """Test case for test_form_oneof - - Test form parameter(s) for oneOf schema # noqa: E501 - """ - pass - if __name__ == '__main__': unittest.main() diff --git a/samples/client/echo_api/python-pydantic-v1/test/test_header_api.py b/samples/client/echo_api/python-pydantic-v1/test/test_header_api.py index 137bd91a65a0..c1b7ed44e8f8 100644 --- a/samples/client/echo_api/python-pydantic-v1/test/test_header_api.py +++ b/samples/client/echo_api/python-pydantic-v1/test/test_header_api.py @@ -3,31 +3,33 @@ """ Echo Server API - Echo Server API + Echo Server API # noqa: E501 The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest +import openapi_client from openapi_client.api.header_api import HeaderApi # noqa: E501 +from openapi_client.rest import ApiException class TestHeaderApi(unittest.TestCase): """HeaderApi unit test stubs""" - def setUp(self) -> None: - self.api = HeaderApi() # noqa: E501 + def setUp(self): + self.api = openapi_client.api.header_api.HeaderApi() # noqa: E501 - def tearDown(self) -> None: + def tearDown(self): pass - def test_test_header_integer_boolean_string(self) -> None: + def test_test_header_integer_boolean_string(self): """Test case for test_header_integer_boolean_string Test header parameter(s) # noqa: E501 diff --git a/samples/client/echo_api/python-pydantic-v1/test/test_manual.py b/samples/client/echo_api/python-pydantic-v1/test/test_manual.py new file mode 100644 index 000000000000..61fbb13b9230 --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/test/test_manual.py @@ -0,0 +1,187 @@ +# coding: utf-8 + +""" + Echo Server API + + Echo Server API # noqa: E501 + + The version of the OpenAPI document: 0.1.0 + Contact: team@openapitools.org + Generated by: https://openapi-generator.tech +""" + +from __future__ import absolute_import + +import unittest +import datetime +import base64 +import os + +import openapi_client +from openapi_client.api.query_api import QueryApi # noqa: E501 +from openapi_client.rest import ApiException + +class TestManual(unittest.TestCase): + """Manually written tests""" + + gif_base64 = "R0lGODlhAQABAIABAP///wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" + + def setUpFiles(self): + self.test_file_dir = os.path.join(os.path.dirname(__file__), "..", "testfiles") + self.test_file_dir = os.path.realpath(self.test_file_dir) + self.test_gif = os.path.join(self.test_file_dir, "test.gif") + + def setUp(self): + self.setUpFiles() + + def tearDown(self): + pass + + def testEnumRefString(self): + api_instance = openapi_client.QueryApi() + q = openapi_client.StringEnumRef("unclassified") + + # Test query parameter(s) + api_response = api_instance.test_enum_ref_string(enum_ref_string_query=q) + e = EchoServerResponseParser(api_response) + self.assertEqual(e.path, "/query/enum_ref_string?enum_ref_string_query=unclassified") + + + def testDateTimeQueryWithDateTimeFormat(self): + api_instance = openapi_client.QueryApi() + datetime_format_backup = api_instance.api_client.configuration.datetime_format # backup dateime_format + api_instance.api_client.configuration.datetime_format = "%Y-%m-%d %a %H:%M:%S%Z" + datetime_query = datetime.datetime.fromisoformat('2013-10-20T19:20:30-05:00') # datetime | (optional) + date_query = '2013-10-20' # date | (optional) + string_query = 'string_query_example' # str | (optional) + + # Test query parameter(s) + api_response = api_instance.test_query_datetime_date_string(datetime_query=datetime_query, date_query=date_query, string_query=string_query) + e = EchoServerResponseParser(api_response) + self.assertEqual(e.path, "/query/datetime/date/string?datetime_query=2013-10-20%20Sun%2019%3A20%3A30UTC-05%3A00&date_query=2013-10-20&string_query=string_query_example") + + # restore datetime format + api_instance.api_client.configuration.datetime_format = datetime_format_backup + + def testDateTimeQueryWithDateTime(self): + api_instance = openapi_client.QueryApi() + datetime_query = datetime.datetime.fromisoformat('2013-10-20T19:20:30-05:00') # datetime | (optional) + date_query = '2013-10-20' # date | (optional) + string_query = 'string_query_example' # str | (optional) + + # Test query parameter(s) + api_response = api_instance.test_query_datetime_date_string(datetime_query=datetime_query, date_query=date_query, string_query=string_query) + e = EchoServerResponseParser(api_response) + self.assertEqual(e.path, "/query/datetime/date/string?datetime_query=2013-10-20T19%3A20%3A30.000000-0500&date_query=2013-10-20&string_query=string_query_example") + + def testBinaryGif(self): + api_instance = openapi_client.BodyApi() + + # Test binary response + api_response = api_instance.test_binary_gif() + self.assertEqual((base64.b64encode(api_response)).decode("utf-8"), self.gif_base64) + + def testNumberPropertiesOnly(self): + n = openapi_client.NumberPropertiesOnly.from_json('{"number": 123, "float": 456, "double": 34}') + self.assertEqual(n.number, 123) + self.assertEqual(n.float, 456) + self.assertEqual(n.double, 34) + + n = openapi_client.NumberPropertiesOnly.from_json('{"number": 123.1, "float": 456.2, "double": 34.3}') + self.assertEqual(n.number, 123.1) + self.assertEqual(n.float, 456.2) + self.assertEqual(n.double, 34.3) + + def testApplicatinOctetStreamBinaryBodyParameter(self): + api_instance = openapi_client.BodyApi() + binary_body = base64.b64decode(self.gif_base64) + api_response = api_instance.test_body_application_octetstream_binary(binary_body) + e = EchoServerResponseParser(api_response) + self.assertEqual(e.path, "/body/application/octetstream/binary") + self.assertEqual(e.headers["Content-Type"], 'application/octet-stream') + self.assertEqual(bytes(e.body, "utf-8"), b'GIF89a\x01\x00\x01\x00\xef\xbf\xbd\x01\x00\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\x00\x00\x00!\xef\xbf\xbd\x04\x01\n\x00\x01\x00,\x00\x00\x00\x00\x01\x00\x01\x00\x00\x02\x02L\x01\x00;') + + def testApplicatinOctetStreamBinaryBodyParameterWithFile(self): + api_instance = openapi_client.BodyApi() + try: + api_response = api_instance.test_body_application_octetstream_binary("invalid_file_path") + except FileNotFoundError as err: + self.assertEqual("[Errno 2] No such file or directory: 'invalid_file_path'", str(err)) + + api_response = api_instance.test_body_application_octetstream_binary(self.test_gif) + e = EchoServerResponseParser(api_response) + self.assertEqual(e.path, "/body/application/octetstream/binary") + self.assertEqual(e.headers["Content-Type"], 'application/octet-stream') + self.assertEqual(bytes(e.body, "utf-8"), b'GIF89a\x01\x00\x01\x00\xef\xbf\xbd\x01\x00\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\x00\x00\x00!\xef\xbf\xbd\x04\x01\n\x00\x01\x00,\x00\x00\x00\x00\x01\x00\x01\x00\x00\x02\x02L\x01\x00;') + + def testBodyParameter(self): + n = openapi_client.Pet.from_dict({"name": "testing", "photoUrls": ["http://1", "http://2"]}) + api_instance = openapi_client.BodyApi() + api_response = api_instance.test_echo_body_pet_response_string(n) + self.assertEqual(api_response, "{'name': 'testing', 'photoUrls': ['http://1', 'http://2']}") + + t = openapi_client.Tag() + api_response = api_instance.test_echo_body_tag_response_string(t) + self.assertEqual(api_response, "{}") # assertion to ensure {} is sent in the body + + api_response = api_instance.test_echo_body_tag_response_string(None) + self.assertEqual(api_response, "") # assertion to ensure emtpy string is sent in the body + + api_response = api_instance.test_echo_body_free_form_object_response_string({}) + self.assertEqual(api_response, "{}") # assertion to ensure {} is sent in the body + + def testAuthHttpBasic(self): + api_instance = openapi_client.AuthApi() + api_response = api_instance.test_auth_http_basic() + e = EchoServerResponseParser(api_response) + self.assertFalse("Authorization" in e.headers) + + api_instance.api_client.configuration.username = "test_username" + api_instance.api_client.configuration.password = "test_password" + api_response = api_instance.test_auth_http_basic() + e = EchoServerResponseParser(api_response) + self.assertTrue("Authorization" in e.headers) + self.assertEqual(e.headers["Authorization"], "Basic dGVzdF91c2VybmFtZTp0ZXN0X3Bhc3N3b3Jk") + + def echoServerResponseParaserTest(self): + s = """POST /echo/body/Pet/response_string HTTP/1.1 +Host: localhost:3000 +Accept-Encoding: identity +Content-Length: 58 +Accept: text/plain +Content-Type: application/json +User-Agent: OpenAPI-Generator/1.0.0/python + +{"name": "testing", "photoUrls": ["http://1", "http://2"]}""" + e = EchoServerResponseParser(s) + self.assertEqual(e.body, '{"name": "testing", "photoUrls": ["http://1", "http://2"]}') + self.assertEqual(e.path, '/echo/body/Pet/response_string') + self.assertEqual(e.headers["Accept"], 'text/plain') + self.assertEqual(e.method, 'POST') + +class EchoServerResponseParser(): + def __init__(self, http_response): + if http_response is None: + raise ValueError("http response must not be None.") + + lines = http_response.splitlines() + self.headers = dict() + x = 0 + while x < len(lines): + if x == 0: + items = lines[x].split(" ") + self.method = items[0]; + self.path = items[1]; + self.protocol = items[2]; + elif lines[x] == "": # blank line + self.body = "\n".join(lines[x+1:]) + break + else: + key_value = lines[x].split(": ") + # store the header key-value pair in headers + if len(key_value) == 2: + self.headers[key_value[0]] = key_value[1] + x = x+1 + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/echo_api/python-pydantic-v1/test/test_number_properties_only.py b/samples/client/echo_api/python-pydantic-v1/test/test_number_properties_only.py index e5072e660a20..68aa757f9df9 100644 --- a/samples/client/echo_api/python-pydantic-v1/test/test_number_properties_only.py +++ b/samples/client/echo_api/python-pydantic-v1/test/test_number_properties_only.py @@ -3,20 +3,22 @@ """ Echo Server API - Echo Server API + Echo Server API # noqa: E501 The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 +""" import unittest import datetime +import openapi_client from openapi_client.models.number_properties_only import NumberPropertiesOnly # noqa: E501 +from openapi_client.rest import ApiException class TestNumberPropertiesOnly(unittest.TestCase): """NumberPropertiesOnly unit test stubs""" @@ -27,21 +29,21 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> NumberPropertiesOnly: + def make_instance(self, include_optional): """Test NumberPropertiesOnly include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `NumberPropertiesOnly` """ - model = NumberPropertiesOnly() # noqa: E501 - if include_optional: + model = openapi_client.models.number_properties_only.NumberPropertiesOnly() # noqa: E501 + if include_optional : return NumberPropertiesOnly( - number = 1.337, - float = 1.337, - double = 0.8 + number = 1.337, + float = 1.337, + double = '' ) - else: + else : return NumberPropertiesOnly( ) """ diff --git a/samples/client/echo_api/python-pydantic-v1/test/test_path_api.py b/samples/client/echo_api/python-pydantic-v1/test/test_path_api.py index 3a75526f3847..4d8e71f7ce6a 100644 --- a/samples/client/echo_api/python-pydantic-v1/test/test_path_api.py +++ b/samples/client/echo_api/python-pydantic-v1/test/test_path_api.py @@ -3,31 +3,33 @@ """ Echo Server API - Echo Server API + Echo Server API # noqa: E501 The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest +import openapi_client from openapi_client.api.path_api import PathApi # noqa: E501 +from openapi_client.rest import ApiException class TestPathApi(unittest.TestCase): """PathApi unit test stubs""" - def setUp(self) -> None: - self.api = PathApi() # noqa: E501 + def setUp(self): + self.api = openapi_client.api.path_api.PathApi() # noqa: E501 - def tearDown(self) -> None: + def tearDown(self): pass - def test_tests_path_string_path_string_integer_path_integer(self) -> None: + def test_tests_path_string_path_string_integer_path_integer(self): """Test case for tests_path_string_path_string_integer_path_integer Test path parameter(s) # noqa: E501 diff --git a/samples/client/echo_api/python-pydantic-v1/test/test_pet.py b/samples/client/echo_api/python-pydantic-v1/test/test_pet.py index 17f0d1221411..e02d8615bc08 100644 --- a/samples/client/echo_api/python-pydantic-v1/test/test_pet.py +++ b/samples/client/echo_api/python-pydantic-v1/test/test_pet.py @@ -3,20 +3,22 @@ """ Echo Server API - Echo Server API + Echo Server API # noqa: E501 The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import openapi_client from openapi_client.models.pet import Pet # noqa: E501 +from openapi_client.rest import ApiException class TestPet(unittest.TestCase): """Pet unit test stubs""" @@ -27,32 +29,32 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> Pet: + def make_instance(self, include_optional): """Test Pet include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Pet` """ - model = Pet() # noqa: E501 - if include_optional: + model = openapi_client.models.pet.Pet() # noqa: E501 + if include_optional : return Pet( - id = 10, - name = 'doggie', + id = 10, + name = 'doggie', category = openapi_client.models.category.Category( id = 1, - name = 'Dogs', ), + name = 'Dogs', ), photo_urls = [ '' - ], + ], tags = [ openapi_client.models.tag.Tag( id = 56, name = '', ) - ], + ], status = 'available' ) - else: + else : return Pet( name = 'doggie', photo_urls = [ diff --git a/samples/client/echo_api/python-pydantic-v1/test/test_query.py b/samples/client/echo_api/python-pydantic-v1/test/test_query.py index bc3dfd5afd1f..a7652e1ae59c 100644 --- a/samples/client/echo_api/python-pydantic-v1/test/test_query.py +++ b/samples/client/echo_api/python-pydantic-v1/test/test_query.py @@ -3,20 +3,22 @@ """ Echo Server API - Echo Server API + Echo Server API # noqa: E501 The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import openapi_client from openapi_client.models.query import Query # noqa: E501 +from openapi_client.rest import ApiException class TestQuery(unittest.TestCase): """Query unit test stubs""" @@ -27,22 +29,22 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> Query: + def make_instance(self, include_optional): """Test Query include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Query` """ - model = Query() # noqa: E501 - if include_optional: + model = openapi_client.models.query.Query() # noqa: E501 + if include_optional : return Query( - id = 56, + id = 56, outcomes = [ 'SUCCESS' ] ) - else: + else : return Query( ) """ diff --git a/samples/client/echo_api/python-pydantic-v1/test/test_query_api.py b/samples/client/echo_api/python-pydantic-v1/test/test_query_api.py index b5d971e159c7..829a635d99b9 100644 --- a/samples/client/echo_api/python-pydantic-v1/test/test_query_api.py +++ b/samples/client/echo_api/python-pydantic-v1/test/test_query_api.py @@ -3,86 +3,53 @@ """ Echo Server API - Echo Server API + Echo Server API # noqa: E501 The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest +import openapi_client from openapi_client.api.query_api import QueryApi # noqa: E501 +from openapi_client.rest import ApiException class TestQueryApi(unittest.TestCase): """QueryApi unit test stubs""" - def setUp(self) -> None: - self.api = QueryApi() # noqa: E501 - - def tearDown(self) -> None: - pass - - def test_test_enum_ref_string(self) -> None: - """Test case for test_enum_ref_string - - Test query parameter(s) # noqa: E501 - """ - pass - - def test_test_query_datetime_date_string(self) -> None: - """Test case for test_query_datetime_date_string + def setUp(self): + self.api = openapi_client.api.query_api.QueryApi() # noqa: E501 - Test query parameter(s) # noqa: E501 - """ + def tearDown(self): pass - def test_test_query_integer_boolean_string(self) -> None: + def test_test_query_integer_boolean_string(self): """Test case for test_query_integer_boolean_string Test query parameter(s) # noqa: E501 """ pass - def test_test_query_style_deep_object_explode_true_object(self) -> None: - """Test case for test_query_style_deep_object_explode_true_object - - Test query parameter(s) # noqa: E501 - """ - pass - - def test_test_query_style_deep_object_explode_true_object_all_of(self) -> None: - """Test case for test_query_style_deep_object_explode_true_object_all_of - - Test query parameter(s) # noqa: E501 - """ - pass - - def test_test_query_style_form_explode_true_array_string(self) -> None: + def test_test_query_style_form_explode_true_array_string(self): """Test case for test_query_style_form_explode_true_array_string Test query parameter(s) # noqa: E501 """ pass - def test_test_query_style_form_explode_true_object(self) -> None: + def test_test_query_style_form_explode_true_object(self): """Test case for test_query_style_form_explode_true_object Test query parameter(s) # noqa: E501 """ pass - def test_test_query_style_form_explode_true_object_all_of(self) -> None: - """Test case for test_query_style_form_explode_true_object_all_of - - Test query parameter(s) # noqa: E501 - """ - pass - if __name__ == '__main__': unittest.main() diff --git a/samples/client/echo_api/python-pydantic-v1/test/test_string_enum_ref.py b/samples/client/echo_api/python-pydantic-v1/test/test_string_enum_ref.py index f48d7776fccf..60a3f0781b18 100644 --- a/samples/client/echo_api/python-pydantic-v1/test/test_string_enum_ref.py +++ b/samples/client/echo_api/python-pydantic-v1/test/test_string_enum_ref.py @@ -3,20 +3,22 @@ """ Echo Server API - Echo Server API + Echo Server API # noqa: E501 The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import openapi_client from openapi_client.models.string_enum_ref import StringEnumRef # noqa: E501 +from openapi_client.rest import ApiException class TestStringEnumRef(unittest.TestCase): """StringEnumRef unit test stubs""" diff --git a/samples/client/echo_api/python-pydantic-v1/test/test_tag.py b/samples/client/echo_api/python-pydantic-v1/test/test_tag.py index ce6f8f0cdbc5..8e48170ab6ae 100644 --- a/samples/client/echo_api/python-pydantic-v1/test/test_tag.py +++ b/samples/client/echo_api/python-pydantic-v1/test/test_tag.py @@ -3,20 +3,22 @@ """ Echo Server API - Echo Server API + Echo Server API # noqa: E501 The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import openapi_client from openapi_client.models.tag import Tag # noqa: E501 +from openapi_client.rest import ApiException class TestTag(unittest.TestCase): """Tag unit test stubs""" @@ -27,20 +29,20 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> Tag: + def make_instance(self, include_optional): """Test Tag include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Tag` """ - model = Tag() # noqa: E501 - if include_optional: + model = openapi_client.models.tag.Tag() # noqa: E501 + if include_optional : return Tag( - id = 56, + id = 56, name = '' ) - else: + else : return Tag( ) """ diff --git a/samples/client/echo_api/python-pydantic-v1/test/test_test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.py b/samples/client/echo_api/python-pydantic-v1/test/test_test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.py index 8063f5b7b630..395407345615 100644 --- a/samples/client/echo_api/python-pydantic-v1/test/test_test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.py +++ b/samples/client/echo_api/python-pydantic-v1/test/test_test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.py @@ -3,20 +3,22 @@ """ Echo Server API - Echo Server API + Echo Server API # noqa: E501 The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import openapi_client from openapi_client.models.test_query_style_deep_object_explode_true_object_all_of_query_object_parameter import TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter # noqa: E501 +from openapi_client.rest import ApiException class TestTestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter(unittest.TestCase): """TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter unit test stubs""" @@ -27,22 +29,22 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter: + def make_instance(self, include_optional): """Test TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter` """ - model = TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter() # noqa: E501 - if include_optional: + model = openapi_client.models.test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter() # noqa: E501 + if include_optional : return TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter( - size = '', - color = '', - id = 1, + size = '', + color = '', + id = 1, name = 'Dogs' ) - else: + else : return TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter( ) """ diff --git a/samples/client/echo_api/python-pydantic-v1/test/test_test_query_style_form_explode_true_array_string_query_object_parameter.py b/samples/client/echo_api/python-pydantic-v1/test/test_test_query_style_form_explode_true_array_string_query_object_parameter.py index f0ce75f334f5..6366b5c23587 100644 --- a/samples/client/echo_api/python-pydantic-v1/test/test_test_query_style_form_explode_true_array_string_query_object_parameter.py +++ b/samples/client/echo_api/python-pydantic-v1/test/test_test_query_style_form_explode_true_array_string_query_object_parameter.py @@ -3,20 +3,22 @@ """ Echo Server API - Echo Server API + Echo Server API # noqa: E501 The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 +from __future__ import absolute_import import unittest import datetime +import openapi_client from openapi_client.models.test_query_style_form_explode_true_array_string_query_object_parameter import TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter # noqa: E501 +from openapi_client.rest import ApiException class TestTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter(unittest.TestCase): """TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter unit test stubs""" @@ -27,21 +29,21 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter: + def make_instance(self, include_optional): """Test TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter` """ - model = TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter() # noqa: E501 - if include_optional: + model = openapi_client.models.test_query_style_form_explode_true_array_string_query_object_parameter.TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter() # noqa: E501 + if include_optional : return TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter( values = [ '' ] ) - else: + else : return TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter( ) """ diff --git a/samples/client/echo_api/python-pydantic-v1/testfiles/test.gif b/samples/client/echo_api/python-pydantic-v1/testfiles/test.gif new file mode 100644 index 0000000000000000000000000000000000000000..9884f476b9c7cec495c94005574d7eb7a39475fa GIT binary patch literal 43 ucmZ?wbhEHbWMp7uXkcXc|NlP&1B2pE7Dg_hfDVuiq!<|(n3#MR8LR=x#0L!k literal 0 HcmV?d00001 From 3886e240cbc238fe7f4685bb4ced882e6c3a521b Mon Sep 17 00:00:00 2001 From: William Cheng Date: Mon, 25 Sep 2023 13:21:03 +0800 Subject: [PATCH 5/7] update samples --- samples/client/echo_api/python-pydantic-v1/README.md | 2 +- samples/openapi3/client/petstore/python-pydantic-v1/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/client/echo_api/python-pydantic-v1/README.md b/samples/client/echo_api/python-pydantic-v1/README.md index d9de36cb6e2d..89af693938f6 100644 --- a/samples/client/echo_api/python-pydantic-v1/README.md +++ b/samples/client/echo_api/python-pydantic-v1/README.md @@ -5,7 +5,7 @@ This Python package is automatically generated by the [OpenAPI Generator](https: - API version: 0.1.0 - Package version: 1.0.0 -- Build package: org.openapitools.codegen.languages.PythonClientCodegen +- Build package: org.openapitools.codegen.languages.PythonPydanticV1ClientCodegen ## Requirements. diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/README.md b/samples/openapi3/client/petstore/python-pydantic-v1/README.md index e4cc8831876b..66eeea58be79 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/README.md +++ b/samples/openapi3/client/petstore/python-pydantic-v1/README.md @@ -5,7 +5,7 @@ This Python package is automatically generated by the [OpenAPI Generator](https: - API version: 1.0.0 - Package version: 1.0.0 -- Build package: org.openapitools.codegen.languages.PythonClientCodegen +- Build package: org.openapitools.codegen.languages.PythonPydanticV1ClientCodegen ## Requirements. From 56bba94444fc4458776cc723b9f91797ca16ad3d Mon Sep 17 00:00:00 2001 From: William Cheng Date: Mon, 25 Sep 2023 14:54:01 +0800 Subject: [PATCH 6/7] update doc --- docs/generators/python-pydantic-v1.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/generators/python-pydantic-v1.md b/docs/generators/python-pydantic-v1.md index e157b9b1a05d..adb3bd45e23b 100644 --- a/docs/generators/python-pydantic-v1.md +++ b/docs/generators/python-pydantic-v1.md @@ -24,7 +24,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |generateSourceCodeOnly|Specifies that only a library source code is to be generated.| |false| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true| -|library|library template (sub-template) to use: asyncio, tornado (deprecated), urllib3| |urllib3| |mapNumberTo|Map number to Union[StrictFloat, StrictInt], StrictStr or float.| |Union[StrictFloat, StrictInt]| |packageName|python package name (convention: snake_case).| |openapi_client| |packageUrl|python package URL.| |null| From acfce054813ca9be0c60fdca5167faf6a5182ecb Mon Sep 17 00:00:00 2001 From: William Cheng Date: Mon, 25 Sep 2023 15:14:14 +0800 Subject: [PATCH 7/7] add back library support --- bin/configs/python-pydantic-v1-aiohttp.yaml | 8 + docs/generators/python-pydantic-v1.md | 1 + .../PythonPydanticV1ClientCodegen.java | 19 +- pom.xml | 1 + .../.github/workflows/python.yml | 38 + .../python-pydantic-v1-aiohttp/.gitignore | 66 + .../python-pydantic-v1-aiohttp/.gitlab-ci.yml | 31 + .../.openapi-generator-ignore | 23 + .../.openapi-generator/FILES | 195 ++ .../.openapi-generator/VERSION | 1 + .../python-pydantic-v1-aiohttp/.travis.yml | 17 + .../python-pydantic-v1-aiohttp/README.md | 268 ++ .../dev-requirements.txt | 2 + .../docs/AdditionalPropertiesAnyType.md | 28 + .../docs/AdditionalPropertiesClass.md | 29 + .../docs/AdditionalPropertiesObject.md | 28 + ...AdditionalPropertiesWithDescriptionOnly.md | 28 + .../docs/AllOfWithSingleRef.md | 29 + .../python-pydantic-v1-aiohttp/docs/Animal.md | 29 + .../docs/AnotherFakeApi.md | 76 + .../docs/AnyOfColor.md | 28 + .../docs/AnyOfPig.md | 30 + .../docs/ApiResponse.md | 30 + .../docs/ArrayOfArrayOfModel.md | 28 + .../docs/ArrayOfArrayOfNumberOnly.md | 28 + .../docs/ArrayOfNumberOnly.md | 28 + .../docs/ArrayTest.md | 30 + .../docs/BasquePig.md | 29 + .../docs/Capitalization.md | 33 + .../python-pydantic-v1-aiohttp/docs/Cat.md | 28 + .../docs/Category.md | 29 + .../docs/CircularReferenceModel.md | 29 + .../docs/ClassModel.md | 29 + .../python-pydantic-v1-aiohttp/docs/Client.md | 28 + .../python-pydantic-v1-aiohttp/docs/Color.md | 28 + .../docs/Creature.md | 29 + .../docs/CreatureInfo.md | 28 + .../docs/DanishPig.md | 29 + .../docs/DefaultApi.md | 69 + .../docs/DeprecatedObject.md | 28 + .../python-pydantic-v1-aiohttp/docs/Dog.md | 28 + .../docs/DummyModel.md | 29 + .../docs/EnumArrays.md | 29 + .../docs/EnumClass.md | 10 + .../docs/EnumString1.md | 10 + .../docs/EnumString2.md | 10 + .../docs/EnumTest.md | 36 + .../docs/FakeApi.md | 1579 +++++++++ .../docs/FakeClassnameTags123Api.md | 87 + .../python-pydantic-v1-aiohttp/docs/File.md | 29 + .../docs/FileSchemaTestClass.md | 29 + .../docs/FirstRef.md | 29 + .../python-pydantic-v1-aiohttp/docs/Foo.md | 28 + .../docs/FooGetDefaultResponse.md | 28 + .../docs/FormatTest.md | 44 + .../docs/HasOnlyReadOnly.md | 29 + .../docs/HealthCheckResult.md | 29 + .../docs/InnerDictWithProperty.md | 28 + .../docs/IntOrString.md | 27 + .../python-pydantic-v1-aiohttp/docs/List.md | 28 + .../docs/MapOfArrayOfModel.md | 28 + .../docs/MapTest.md | 31 + ...dPropertiesAndAdditionalPropertiesClass.md | 30 + .../docs/Model200Response.md | 30 + .../docs/ModelReturn.md | 29 + .../python-pydantic-v1-aiohttp/docs/Name.md | 32 + .../docs/NullableClass.md | 40 + .../docs/NullableProperty.md | 29 + .../docs/NumberOnly.md | 28 + .../docs/ObjectToTestAdditionalProperties.md | 29 + .../docs/ObjectWithDeprecatedFields.md | 31 + .../docs/OneOfEnumString.md | 28 + .../python-pydantic-v1-aiohttp/docs/Order.md | 33 + .../docs/OuterComposite.md | 30 + .../docs/OuterEnum.md | 10 + .../docs/OuterEnumDefaultValue.md | 10 + .../docs/OuterEnumInteger.md | 10 + .../docs/OuterEnumIntegerDefaultValue.md | 10 + .../docs/OuterObjectWithEnumProperty.md | 29 + .../python-pydantic-v1-aiohttp/docs/Parent.md | 28 + .../docs/ParentWithOptionalDict.md | 28 + .../python-pydantic-v1-aiohttp/docs/Pet.md | 33 + .../python-pydantic-v1-aiohttp/docs/PetApi.md | 953 ++++++ .../python-pydantic-v1-aiohttp/docs/Pig.md | 30 + .../docs/PropertyNameCollision.md | 30 + .../docs/ReadOnlyFirst.md | 29 + .../docs/SecondRef.md | 29 + .../docs/SelfReferenceModel.md | 29 + .../docs/SingleRefType.md | 10 + .../docs/SpecialCharacterEnum.md | 10 + .../docs/SpecialModelName.md | 28 + .../docs/SpecialName.md | 30 + .../docs/StoreApi.md | 287 ++ .../python-pydantic-v1-aiohttp/docs/Tag.md | 29 + ...lineFreeformAdditionalPropertiesRequest.md | 28 + .../python-pydantic-v1-aiohttp/docs/Tiger.md | 28 + .../python-pydantic-v1-aiohttp/docs/User.md | 35 + .../docs/UserApi.md | 542 +++ .../docs/WithNestedOneOf.md | 30 + .../python-pydantic-v1-aiohttp/git_push.sh | 57 + .../petstore_api/__init__.py | 119 + .../petstore_api/api/__init__.py | 11 + .../petstore_api/api/another_fake_api.py | 176 + .../petstore_api/api/default_api.py | 155 + .../petstore_api/api/fake_api.py | 3028 +++++++++++++++++ .../api/fake_classname_tags123_api.py | 176 + .../petstore_api/api/pet_api.py | 1239 +++++++ .../petstore_api/api/store_api.py | 539 +++ .../petstore_api/api/user_api.py | 1055 ++++++ .../petstore_api/api_client.py | 737 ++++ .../petstore_api/api_response.py | 25 + .../petstore_api/configuration.py | 601 ++++ .../petstore_api/exceptions.py | 166 + .../petstore_api/models/__init__.py | 95 + .../models/additional_properties_any_type.py | 83 + .../models/additional_properties_class.py | 73 + .../models/additional_properties_object.py | 83 + ...tional_properties_with_description_only.py | 83 + .../models/all_of_with_single_ref.py | 74 + .../petstore_api/models/animal.py | 92 + .../petstore_api/models/any_of_color.py | 155 + .../petstore_api/models/any_of_pig.py | 134 + .../petstore_api/models/api_response.py | 75 + .../models/array_of_array_of_model.py | 84 + .../models/array_of_array_of_number_only.py | 71 + .../models/array_of_number_only.py | 71 + .../petstore_api/models/array_test.py | 88 + .../petstore_api/models/basque_pig.py | 73 + .../petstore_api/models/capitalization.py | 81 + .../petstore_api/models/cat.py | 74 + .../petstore_api/models/category.py | 73 + .../models/circular_reference_model.py | 78 + .../petstore_api/models/class_model.py | 71 + .../petstore_api/models/client.py | 71 + .../petstore_api/models/color.py | 170 + .../petstore_api/models/creature.py | 77 + .../petstore_api/models/creature_info.py | 71 + .../petstore_api/models/danish_pig.py | 73 + .../petstore_api/models/deprecated_object.py | 71 + .../petstore_api/models/dog.py | 74 + .../petstore_api/models/dummy_model.py | 78 + .../petstore_api/models/enum_arrays.py | 94 + .../petstore_api/models/enum_class.py | 41 + .../petstore_api/models/enum_string1.py | 40 + .../petstore_api/models/enum_string2.py | 40 + .../petstore_api/models/enum_test.py | 143 + .../petstore_api/models/file.py | 71 + .../models/file_schema_test_class.py | 84 + .../petstore_api/models/first_ref.py | 78 + .../petstore_api/models/foo.py | 71 + .../models/foo_get_default_response.py | 75 + .../petstore_api/models/format_test.py | 143 + .../petstore_api/models/has_only_read_only.py | 75 + .../models/health_check_result.py | 76 + .../models/inner_dict_with_property.py | 71 + .../petstore_api/models/int_or_string.py | 147 + .../petstore_api/models/list.py | 71 + .../models/map_of_array_of_model.py | 88 + .../petstore_api/models/map_test.py | 87 + ...perties_and_additional_properties_class.py | 88 + .../petstore_api/models/model200_response.py | 73 + .../petstore_api/models/model_return.py | 71 + .../petstore_api/models/name.py | 79 + .../petstore_api/models/nullable_class.py | 162 + .../petstore_api/models/nullable_property.py | 88 + .../petstore_api/models/number_only.py | 71 + .../object_to_test_additional_properties.py | 71 + .../models/object_with_deprecated_fields.py | 81 + .../petstore_api/models/one_of_enum_string.py | 141 + .../petstore_api/models/order.py | 91 + .../petstore_api/models/outer_composite.py | 75 + .../petstore_api/models/outer_enum.py | 41 + .../models/outer_enum_default_value.py | 41 + .../petstore_api/models/outer_enum_integer.py | 41 + .../outer_enum_integer_default_value.py | 42 + .../models/outer_object_with_enum_property.py | 80 + .../petstore_api/models/parent.py | 84 + .../models/parent_with_optional_dict.py | 84 + .../petstore_api/models/pet.py | 103 + .../petstore_api/models/pig.py | 144 + .../models/property_name_collision.py | 75 + .../petstore_api/models/read_only_first.py | 74 + .../petstore_api/models/second_ref.py | 78 + .../models/self_reference_model.py | 78 + .../petstore_api/models/single_ref_type.py | 40 + .../models/special_character_enum.py | 48 + .../petstore_api/models/special_model_name.py | 71 + .../petstore_api/models/special_name.py | 89 + .../petstore_api/models/tag.py | 73 + ..._freeform_additional_properties_request.py | 83 + .../petstore_api/models/tiger.py | 71 + .../petstore_api/models/user.py | 85 + .../petstore_api/models/with_nested_one_of.py | 83 + .../petstore_api/py.typed | 0 .../petstore_api/rest.py | 251 ++ .../petstore_api/signing.py | 413 +++ .../python-pydantic-v1-aiohttp/pom.xml | 46 + .../python-pydantic-v1-aiohttp/pyproject.toml | 33 + .../requirements.txt | 7 + .../python-pydantic-v1-aiohttp/setup.cfg | 2 + .../python-pydantic-v1-aiohttp/setup.py | 53 + .../test-requirements.txt | 3 + .../test/__init__.py | 0 .../test_additional_properties_any_type.py | 54 + .../test/test_additional_properties_class.py | 61 + .../test/test_additional_properties_object.py | 54 + ...tional_properties_with_description_only.py | 54 + .../test/test_all_of_with_single_ref.py | 52 + .../test/test_animal.py | 53 + .../test/test_another_fake_api.py | 40 + .../test/test_any_of_color.py | 53 + .../test/test_any_of_pig.py | 56 + .../test/test_api_response.py | 53 + .../test/test_array_of_array_of_model.py | 60 + .../test_array_of_array_of_number_only.py | 55 + .../test/test_array_of_number_only.py | 53 + .../test/test_array_test.py | 65 + .../test/test_basque_pig.py | 54 + .../test/test_capitalization.py | 56 + .../test/test_cat.py | 51 + .../test/test_category.py | 53 + .../test/test_circular_reference_model.py | 64 + .../test/test_class_model.py | 51 + .../test/test_client.py | 51 + .../test/test_color.py | 53 + .../test/test_creature.py | 59 + .../test/test_creature_info.py | 55 + .../test/test_danish_pig.py | 54 + .../test/test_default_api.py | 39 + .../test/test_deprecated_object.py | 51 + .../test/test_dog.py | 51 + .../test/test_dummy_model.py | 58 + .../test/test_enum_arrays.py | 54 + .../test/test_enum_class.py | 36 + .../test/test_enum_string1.py | 36 + .../test/test_enum_string2.py | 36 + .../test/test_enum_test.py | 55 + .../test/test_fake_api.py | 136 + .../test/test_fake_classname_tags123_api.py | 40 + .../test/test_file.py | 51 + .../test/test_file_schema_test_class.py | 56 + .../test/test_first_ref.py | 62 + .../test/test_foo.py | 51 + .../test/test_foo_get_default_response.py | 52 + .../test/test_format_test.py | 69 + .../test/test_has_only_read_only.py | 52 + .../test/test_health_check_result.py | 51 + .../test/test_inner_dict_with_property.py | 56 + .../test/test_int_or_string.py | 53 + .../test/test_list.py | 51 + .../test/test_map_of_array_of_model.py | 60 + .../test/test_map_test.py | 64 + ...perties_and_additional_properties_class.py | 57 + .../test/test_model200_response.py | 52 + .../test/test_model_return.py | 51 + .../test/test_name.py | 55 + .../test/test_nullable_class.py | 76 + .../test/test_nullable_property.py | 57 + .../test/test_number_only.py | 51 + ...st_object_to_test_additional_properties.py | 54 + .../test_object_with_deprecated_fields.py | 57 + .../test/test_one_of_enum_string.py | 53 + .../test/test_order.py | 56 + .../test/test_outer_composite.py | 53 + .../test/test_outer_enum.py | 36 + .../test/test_outer_enum_default_value.py | 36 + .../test/test_outer_enum_integer.py | 36 + .../test_outer_enum_integer_default_value.py | 36 + .../test_outer_object_with_enum_property.py | 52 + .../test/test_parent.py | 57 + .../test/test_parent_with_optional_dict.py | 59 + .../test/test_pet.py | 68 + .../test/test_pet_api.py | 96 + .../test/test_pig.py | 56 + .../test/test_property_name_collision.py | 56 + .../test/test_read_only_first.py | 52 + .../test/test_second_ref.py | 62 + .../test/test_self_reference_model.py | 60 + .../test/test_single_ref_type.py | 36 + .../test/test_special_character_enum.py | 36 + .../test/test_special_model_name.py | 51 + .../test/test_special_name.py | 58 + .../test/test_store_api.py | 61 + .../test/test_tag.py | 52 + ..._freeform_additional_properties_request.py | 52 + .../test/test_tiger.py | 54 + .../test/test_user.py | 58 + .../test/test_user_api.py | 89 + .../test/test_with_nested_one_of.py | 52 + .../test_python3.sh | 31 + .../testfiles/foo.png | Bin 0 -> 43280 bytes .../tests/__init__.py | 0 .../tests/test_api_client.py | 22 + .../tests/test_model.py | 237 ++ .../tests/test_pet_api.py | 208 ++ .../tests/test_pet_model.py | 114 + .../python-pydantic-v1-aiohttp/tests/util.py | 19 + .../python-pydantic-v1-aiohttp/tox.ini | 9 + 298 files changed, 27262 insertions(+), 1 deletion(-) create mode 100644 bin/configs/python-pydantic-v1-aiohttp.yaml create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.github/workflows/python.yml create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.gitignore create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.gitlab-ci.yml create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.openapi-generator-ignore create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.openapi-generator/FILES create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.openapi-generator/VERSION create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.travis.yml create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/README.md create mode 100755 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/dev-requirements.txt create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AdditionalPropertiesAnyType.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AdditionalPropertiesClass.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AdditionalPropertiesObject.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AdditionalPropertiesWithDescriptionOnly.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AllOfWithSingleRef.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Animal.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AnotherFakeApi.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AnyOfColor.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AnyOfPig.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ApiResponse.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ArrayOfArrayOfModel.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ArrayOfArrayOfNumberOnly.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ArrayOfNumberOnly.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ArrayTest.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/BasquePig.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Capitalization.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Cat.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Category.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/CircularReferenceModel.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ClassModel.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Client.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Color.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Creature.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/CreatureInfo.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/DanishPig.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/DefaultApi.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/DeprecatedObject.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Dog.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/DummyModel.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/EnumArrays.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/EnumClass.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/EnumString1.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/EnumString2.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/EnumTest.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FakeApi.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FakeClassnameTags123Api.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/File.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FileSchemaTestClass.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FirstRef.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Foo.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FooGetDefaultResponse.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FormatTest.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/HasOnlyReadOnly.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/HealthCheckResult.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/InnerDictWithProperty.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/IntOrString.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/List.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/MapOfArrayOfModel.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/MapTest.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/MixedPropertiesAndAdditionalPropertiesClass.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Model200Response.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ModelReturn.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Name.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/NullableClass.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/NullableProperty.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/NumberOnly.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ObjectToTestAdditionalProperties.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ObjectWithDeprecatedFields.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OneOfEnumString.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Order.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OuterComposite.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OuterEnum.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OuterEnumDefaultValue.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OuterEnumInteger.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OuterEnumIntegerDefaultValue.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OuterObjectWithEnumProperty.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Parent.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ParentWithOptionalDict.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Pet.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/PetApi.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Pig.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/PropertyNameCollision.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ReadOnlyFirst.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/SecondRef.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/SelfReferenceModel.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/SingleRefType.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/SpecialCharacterEnum.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/SpecialModelName.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/SpecialName.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/StoreApi.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Tag.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/TestInlineFreeformAdditionalPropertiesRequest.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Tiger.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/User.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/UserApi.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/WithNestedOneOf.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/git_push.sh create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/__init__.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/__init__.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/another_fake_api.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/default_api.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/fake_api.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/fake_classname_tags123_api.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/pet_api.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/store_api.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/user_api.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api_client.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api_response.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/configuration.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/exceptions.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/__init__.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/additional_properties_any_type.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/additional_properties_class.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/additional_properties_object.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/additional_properties_with_description_only.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/all_of_with_single_ref.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/animal.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/any_of_color.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/any_of_pig.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/api_response.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/array_of_array_of_model.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/array_of_array_of_number_only.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/array_of_number_only.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/array_test.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/basque_pig.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/capitalization.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/cat.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/category.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/circular_reference_model.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/class_model.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/client.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/color.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/creature.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/creature_info.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/danish_pig.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/deprecated_object.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/dog.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/dummy_model.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/enum_arrays.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/enum_class.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/enum_string1.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/enum_string2.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/enum_test.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/file.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/file_schema_test_class.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/first_ref.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/foo.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/foo_get_default_response.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/format_test.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/has_only_read_only.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/health_check_result.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/inner_dict_with_property.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/int_or_string.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/list.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/map_of_array_of_model.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/map_test.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/mixed_properties_and_additional_properties_class.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/model200_response.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/model_return.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/name.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/nullable_class.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/nullable_property.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/number_only.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/object_to_test_additional_properties.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/object_with_deprecated_fields.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/one_of_enum_string.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/order.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/outer_composite.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/outer_enum.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/outer_enum_default_value.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/outer_enum_integer.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/outer_enum_integer_default_value.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/outer_object_with_enum_property.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/parent.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/parent_with_optional_dict.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/pet.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/pig.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/property_name_collision.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/read_only_first.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/second_ref.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/self_reference_model.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/single_ref_type.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/special_character_enum.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/special_model_name.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/special_name.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/tag.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/test_inline_freeform_additional_properties_request.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/tiger.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/user.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/with_nested_one_of.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/py.typed create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/rest.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/signing.py create mode 100755 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/pom.xml create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/pyproject.toml create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/requirements.txt create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/setup.cfg create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/setup.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test-requirements.txt create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/__init__.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_additional_properties_any_type.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_additional_properties_class.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_additional_properties_object.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_additional_properties_with_description_only.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_all_of_with_single_ref.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_animal.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_another_fake_api.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_any_of_color.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_any_of_pig.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_api_response.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_array_of_array_of_model.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_array_of_array_of_number_only.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_array_of_number_only.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_array_test.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_basque_pig.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_capitalization.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_cat.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_category.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_circular_reference_model.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_class_model.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_client.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_color.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_creature.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_creature_info.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_danish_pig.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_default_api.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_deprecated_object.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_dog.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_dummy_model.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_enum_arrays.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_enum_class.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_enum_string1.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_enum_string2.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_enum_test.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_fake_api.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_fake_classname_tags123_api.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_file.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_file_schema_test_class.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_first_ref.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_foo.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_foo_get_default_response.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_format_test.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_has_only_read_only.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_health_check_result.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_inner_dict_with_property.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_int_or_string.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_list.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_map_of_array_of_model.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_map_test.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_mixed_properties_and_additional_properties_class.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_model200_response.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_model_return.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_name.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_nullable_class.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_nullable_property.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_number_only.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_object_to_test_additional_properties.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_object_with_deprecated_fields.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_one_of_enum_string.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_order.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_outer_composite.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_outer_enum.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_outer_enum_default_value.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_outer_enum_integer.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_outer_enum_integer_default_value.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_outer_object_with_enum_property.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_parent.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_parent_with_optional_dict.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_pet.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_pet_api.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_pig.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_property_name_collision.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_read_only_first.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_second_ref.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_self_reference_model.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_single_ref_type.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_special_character_enum.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_special_model_name.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_special_name.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_store_api.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_tag.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_test_inline_freeform_additional_properties_request.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_tiger.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_user.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_user_api.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_with_nested_one_of.py create mode 100755 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test_python3.sh create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/testfiles/foo.png create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/tests/__init__.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/tests/test_api_client.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/tests/test_model.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/tests/test_pet_api.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/tests/test_pet_model.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/tests/util.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/tox.ini diff --git a/bin/configs/python-pydantic-v1-aiohttp.yaml b/bin/configs/python-pydantic-v1-aiohttp.yaml new file mode 100644 index 000000000000..2ba8f2326741 --- /dev/null +++ b/bin/configs/python-pydantic-v1-aiohttp.yaml @@ -0,0 +1,8 @@ +generatorName: python-pydantic-v1 +outputDir: samples/openapi3/client/petstore/python-pydantic-v1-aiohttp +inputSpec: modules/openapi-generator/src/test/resources/3_0/python/petstore-with-fake-endpoints-models-for-testing.yaml +templateDir: modules/openapi-generator/src/main/resources/python-pydantic-v1 +library: asyncio +additionalProperties: + packageName: petstore_api + mapNumberTo: float diff --git a/docs/generators/python-pydantic-v1.md b/docs/generators/python-pydantic-v1.md index adb3bd45e23b..e157b9b1a05d 100644 --- a/docs/generators/python-pydantic-v1.md +++ b/docs/generators/python-pydantic-v1.md @@ -24,6 +24,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |generateSourceCodeOnly|Specifies that only a library source code is to be generated.| |false| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true| +|library|library template (sub-template) to use: asyncio, tornado (deprecated), urllib3| |urllib3| |mapNumberTo|Map number to Union[StrictFloat, StrictInt], StrictStr or float.| |Union[StrictFloat, StrictInt]| |packageName|python package name (convention: snake_case).| |openapi_client| |packageUrl|python package URL.| |null| diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonPydanticV1ClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonPydanticV1ClientCodegen.java index 708a0f6280d3..08db2c380ac3 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonPydanticV1ClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonPydanticV1ClientCodegen.java @@ -165,6 +165,14 @@ public PythonPydanticV1ClientCodegen() { .defaultValue("%Y-%m-%d")); cliOptions.add(new CliOption(CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP, CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP_DESC).defaultValue("false")); + supportedLibraries.put("urllib3", "urllib3-based client"); + supportedLibraries.put("asyncio", "asyncio-based client"); + supportedLibraries.put("tornado", "tornado-based client (deprecated)"); + CliOption libraryOption = new CliOption(CodegenConstants.LIBRARY, "library template (sub-template) to use: asyncio, tornado (deprecated), urllib3"); + libraryOption.setDefault(DEFAULT_LIBRARY); + cliOptions.add(libraryOption); + setLibrary(DEFAULT_LIBRARY); + // option to change how we process + set the data in the 'additionalProperties' keyword. CliOption disallowAdditionalPropertiesIfNotPresentOpt = CliOption.newBoolean( CodegenConstants.DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT, @@ -327,7 +335,16 @@ public void processOpts() { supportingFiles.add(new SupportingFile("api_client.mustache", packagePath(), "api_client.py")); supportingFiles.add(new SupportingFile("api_response.mustache", packagePath(), "api_response.py")); - supportingFiles.add(new SupportingFile("rest.mustache", packagePath(), "rest.py")); + + if ("asyncio".equals(getLibrary())) { + supportingFiles.add(new SupportingFile("asyncio/rest.mustache", packagePath(), "rest.py")); + additionalProperties.put("asyncio", "true"); + } else if ("tornado".equals(getLibrary())) { + supportingFiles.add(new SupportingFile("tornado/rest.mustache", packagePath(), "rest.py")); + additionalProperties.put("tornado", "true"); + } else { + supportingFiles.add(new SupportingFile("rest.mustache", packagePath(), "rest.py")); + } modelPackage = this.packageName + "." + modelPackage; apiPackage = this.packageName + "." + apiPackage; diff --git a/pom.xml b/pom.xml index 31051404b8ef..2ac0d20cd1d4 100644 --- a/pom.xml +++ b/pom.xml @@ -1219,6 +1219,7 @@ samples/openapi3/client/petstore/python samples/openapi3/client/petstore/python-pydantic-v1 samples/openapi3/client/petstore/python-aiohttp + samples/openapi3/client/petstore/python-pydantic-v1-aiohttp